It just depends on how your directive is specified.
If the directive has the following declaration:
scope:{ ngHide: '=' }
then you do not need to use a double mustache because the directive expects an object
If the directive is declared as follows:
scope:{ ngMin:'@' }
then he expects value. If your value comes from a javascript variable, you need to use curly braces to interpolate the string contained in your variable.
EDIT:
It has been a long time since I read the angular source code.
I did not find the source code to prove my point:
ngController , which expects the string to be declared as follows
var ngControllerDirective = [function() { return { restrict: 'A', scope: true, controller: '@', priority: 500 }; }];
https://github.com/angular/angular.js/blob/master/src/ng/directive/ngController.js#L3
ngMaxLength
var maxlengthDirective = function() { return { restrict: 'A', require: '?ngModel', link: function(scope, elm, attr, ctrl) { if (!ctrl) return; var maxlength = -1; attr.$observe('maxlength', function(value) { var intVal = toInt(value); maxlength = isNaN(intVal) ? -1 : intVal; ctrl.$validate(); }); ctrl.$validators.maxlength = function(modelValue, viewValue) { return (maxlength < 0) || ctrl.$isEmpty(viewValue) || (viewValue.length <= maxlength); }; } }; };
https://github.com/angular/angular.js/blob/master/src/ng/directive/validators.js#L186
source share