Angular ng-repeat alias in the repeat expression?
angularjs, angularjs-ng-repeat
Solution
Here is the script to put into controller
$scope.scopify = function(scope, obj){
for (var a in obj) {
scope[a] = obj[a];
}
}
Then call it like this
<li ng-repeat="user in users" ng-init="scopify(this,user)">
{{firstName}}
</li>
Problem
Given a template like this: ``` <li ng-repeat="user in users"> {{user.firstName}} </li> ``` Is there any way to "alias" the "user" so I can do this instead: ``` <li ng-repeat="SOME MAGIC HERE MAYBE?"> {{firstName}} </li> ``` So that I don't need to type the "user." prefix for each expression?