javascript - AngularJS ng-model for multiple inputs inside directive -


so have directive 21 inputs in it. want set ng-modelbased on attribute passed when calling directive. if {{myattr}} inside directive outputs attribute i've set, if include ng-model="{{myattr}}" things break.

angular.module('myapp') .directive('program', function () { return {   templateurl: 'app/program/program.html',   restrict: 'ea',   link: function (scope, element, attrs) {     scope.daymodel = 'program.' + attrs.day + 'first';   } }; }); 

you use {{variablename}} in pure html-text, angularjs can replace value of variable @ runtime:

http://jsfiddle.net/joshdmiller/hb7lu/

but never write ng-form="{{myattr}}" in html-tag, instead have write ng-form="myattr" {{}} serves way angularjs distinguish between plain text , variable/code. in html-tags there no plain text, instead interpreted variable/code.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -