javascript - How to use Functional $scope methods in HTML templates without using ng-click? -
i learning angular next project, confused how use $scope variable (call function) in template file, example find use ng-click, or more general how access business logic of controller in templates views? example have function
$scope.rows = function(){ var rownumber; rownumber = math.floor($scope.itemnumber / 6); var rows = []; for(var = 0; < rownumber; i++){ rows.push('row'+ i); console.log(rows); } return rows; };
i want access rows array getting dynamically generated in ng-repeat?
its easy, use
<div ng-repeat="row in rows()"> <span>{{ row }} </span> </div>
here more information ng-repeat https://docs.angularjs.org/api/ng/directive/ngrepeat
Comments
Post a Comment