I need to change the ng-init value with the function in the controller
& lt; Div ng -app ng-controller = "FilterManager" data-ng-init = "filterable = false;" & Gt; & Lt; P & gt; Name: {{Filter Visitor}} & lt; / P & gt; & Lt; A href = "javascript: zero (0);" Data-ng-click = "setFilter ();" & Gt; Click & lt; / A & gt; & Lt; / Div & gt; & Lt; Script type = "text / javascript" & gt; Function Filters Manager ($ scope) {$ scope.setFilter = function () {FilterVisible = true; }; } & Lt; / Script & gt;
Why does this code not work? Thanks
@PSL Your code works fine, but if I am in NG-repeat, how can I do it?
& lt; Div ng-app = "myApp" ng-controller = "mancruten" & gt; & Lt; Div ng-repeat = "column in c" & gt; & Lt; Div ng-init = "FilterVisible = false" data-ng-click = "set filter"; " & Gt; {{C.name}} {{FiltersView}} & lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Script type = "text / javascript" & gt; Var app = angular Module ('myApp', []); App.controller ('MainCtrl', function ($ scope) {$ scope.column = [{'name': 1}, {'name': 2}, {'name': 3}]; $ scope.setFilter = Function () {FilterVisible = true;};});
Comments
Post a Comment