What’s the meaning of require: ‘ngModel’?

[Origin]: https://stackoverflow.com/questions/20930592/whats-the-meaning-of-require-ngmodel

This is the HTML for my directive:

<textarea data-modal="modal" data-mydir ng:model="abc"></textarea>

In my directive I have this:

return {
        require: 'ngModel',
        replace: true,
        scope: {
            modal: '=modal',
            ngModel: '=',
            pid: '=pid'
        },

Can someone tell me, what’s the significance of require: ‘ngModel’ ? I see this in many different directives. Could I call this data-modal?

I am confused because when I change it to data-modal I get a message from Angular saying

Controller 'ngModel', required by directive 'textarea', can't be found!

Tried to Load Angular More Than Once

[Origin]: https://stackoverflow.com/questions/22595878/tried-to-load-angular-more-than-once

This could be a number of issues: essentially it’s a problem of routeProvider not finding a file and recursively loading the default.

For me, it turned out that it wasn’t minification but concatenation of the js that caused the problems.

angular.module('myApp').config(['$routeProvider', function ($routeProvider) {
    $routeProvider
      .when('/', {
        templateUrl: 'views/listing.html',
        controller: 'ListingCtrl'
      })
      .otherwise({
        redirectTo: '/'
      });
  }]).constant('FIREBASE_URL', 'something');

You’ll notice that if the app can’t find a file (i.e., otherwise), then it will redirect to the root, which in this case loads the templateUrl. But if your templateUrl is wrong, then it will cause a recursion that reloads index.html loading angular (and everything else) over and over.

In my case, grunt-concat caused the templateUrl to be wrong after build, but not before.

I had the same issue, The problem was the conflict between JQuery and Angular. Angular couldn’t set the full JQuery library for itself. As JQLite is enough in most cases, I included Angular first in my web page and then I loaded Jquery. The error was gone then.

How to remove currency symbol in AngularJS

[Origin]: https://stackoverflow.com/questions/31174600/how-to-remove-currency-symbol-in-angularjs

Can anybody tell how to remove the currency symbol in AngularJS?

value = $filter('currency')(value);

I am getting a dollar symbol. I want to remove it.

Just pass empty string as second argument to the filter function.

value = $filter('currency')(value, "");

Also you can inject currencyFilter itself. You do not have to derive it from the filter Factory, with that you would just do:

value = currencyFilter(value, "");

Note the syntax:

$filter('currency')(amount, symbol, fractionSize)

ARIA: Attribute ” aria-label “, required for accessibility, is missing on node

[Origin]: https://github.com/textAngular/textAngular/issues/1446

when using with angular material it shows the warning about aria label
ARIA: Attribute " aria-label ", required for accessibility, is missing on node:

<textarea id="taHtmlElement8316965102261715" ng-show="showHtml" ta-bind="ta-bind" ng-model="html" class="ng-pristine ng-untouched ng-valid ng-scope md-input ta-bind ta-html ta-editor form-control ng-empty ng-hide" rows="1" aria-hidden="true" aria-invalid="false" style="height: 0px;"></textarea>

where we have to add aria attribute in textangular directive

I Resolved this issue by adding the aria-label attribute.

aria-label="ShowHideAccountant"

if you have multiple fields and you want to ignore the issue in your application. Try to set $mdAriaProvider.disableWarnings();

app.config(function($mdAriaProvider) {
   // Globally disables all ARIA warnings.
   $mdAriaProvider.disableWarnings();
});

Solution to your problem: you have to add attribute to your input, select, Textarea tags
Example : <textarea aria-label="Your Field Lable name"></textarea>

Angular: what is filterFilter

[Origin]: https://stackoverflow.com/questions/36702123/angular-what-is-filterfilter

i am new in angular and i am bit familiar with filter word but what is filterFilter word and usage in angular. just come across a code below from this url https://stackoverflow.com/a/22704140/6188148.

see the code

angular.module('FilterInControllerModule', []).
    controller('FilterController', ['filterFilter', function(filterFilter) {
      this.array = [
        {name: 'Tobias'},
        {name: 'Jeff'},
        {name: 'Brian'},
        {name: 'Igor'},
        {name: 'James'},
        {name: 'Brad'}
      ];
      this.filteredArray = filterFilter(this.array, {name:'Igor'});
    }]);

just tell me what is filterFilter ? is it any built-in filter ?

Angular filter names just have to end with Filter in order to be a valid filter.

SQL to JSON – array of objects to array of values in SQL 2016

[Origin]: https://stackoverflow.com/questions/37708638/sql-to-json-array-of-objects-to-array-of-values-in-sql-2016

SQL 2016 has a new feature which converts data on SQL server to JSON. I am having difficulty in combining array of objects into array of values i.e.,

EXAMPLE –

CREATE TABLE #temp (item_id VARCHAR(256))

INSERT INTO #temp VALUES ('1234'),('5678'),('7890')

SELECT * FROM #temp

--convert to JSON

SELECT (SELECT item_id 
FROM #temp
FOR JSON PATH,root('ids')) 

RESULT –

{
    "ids": [{
        "item_id": "1234"
    },
    {
        "item_id": "5678"
    },
    {
        "item_id": "7890"
    }]
}

But I want the result as –

"ids": [
        "1234",
        "5678",
        "7890"
    ]

Can somebody please help me out?