javascript - ng-click to update a model won't work without invoking method on scope -


i have simple widget i'm building has multiple panes. i'm trying switch between them way of font-awesome icons along top. $scope has model selected i'd update when people click 1 of icons.

i have been able accomplish invoking method off of $scope, so:

<i ng-repeat="cat in widget.data"    ng-click="updateselected(cat.type)"> </i> 

and in controller:

$scope.updateselected = function (type) { $scope.selected = type; }; 

however, i'd more directly updating selected model directly in ng-click attribute, so:

<i ng-repeat="cat in widget.data"    ng-click="selected=cat.type"> </i> 

i've not been able work i'm wondering -- supposed able directly update model in fashion? or need write handler function?


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -