angularjs - Angular directive not working with ng-repeat -
I made an angular instruction but it will not work with Javascript: HTML: The problem is that at the point you are bound to change the event, angular is ng - Douba has not been provided so far if you want to give it time to render it to everyone, then it should be done. Here is a job I will suggest you to use ng-change and ng-model in your input and will do more in a slightly more parallel way. You should know about the place that you are expected to use in mutually-used instructions. ng-repeat I do not know why The second instruction runs successfully.
Angular Module ('myApp', []). Controller ('Ctrl', ['$ scope', function ($ scope) {$ scope.vvv = []; $ scope.bbb = []; $ scope.testdatas = [{text: 0}, {text: 1 }, {Text: 2}, {text: 3}]}]]). Directive ('wstCheckbox', function) {return {restricted: 'EA, replace: correct, template:' & lt; Div ng-transclude & gt; & Lt; / Div & gt; , Scope: {modelname: '=' // ths is model}, translact: true, link: function (scope, element, etters) {console.log (element) $ (element). Find ('input' [type = ('input' (check) '). (' Change ', function () {scope.modelname = []; scope. $ Apply (function () {$ (element). ('Input [type = checkbox]: checked'). (Function () (scope.modelname.push ($ (this) .val ());}}}}}}}}}) < / Pre>
label = "6"> Index 2 & lt; / Label & gt; & Lt; Input type = "checkbox" name = "test" value = "3" id = "7" /> gt; & Lt; / WST-checkbox & gt; & Lt; / Div & gt;
link: function (scope, element, etter) {console log (element) $ timeout (function () {$ (element) .find ('Input [type = checkbox]'). ('Change', function () {scope.modelname = []] scope. $ Apply function () {$ (element) .find ('input [type = Checkbox]: checked '). Each (function () {scope.modelname.push ($ (this) .val ());})})}})}, 0); }
Comments
Post a Comment