AngularJS For Loop with Numbers & Ranges

后端 未结 24 3131
抹茶落季
抹茶落季 2020-11-22 13:40

Angular does provide some support for a for loop using numbers within its HTML directives:

do something <
24条回答
  •  遇见更好的自我
    2020-11-22 14:39

    Using UnderscoreJS:

    angular.module('myModule')
        .run(['$rootScope', function($rootScope) { $rootScope.range = _.range; }]);
    

    Applying this to $rootScope makes it available everywhere:

    {{x}}

提交回复
热议问题