如何将javascript变量连接到angularJS?

时间:2019-03-26 09:30:52

标签: javascript angularjs

这是angularJS和javascript代码:

var app = angular.module('app', []);
app.controller('mainController', function ($scope) {
    var test = ["variable1","variable2"];
    for(var i=0;i<test.length;i++){
        $scope.+""+test[i] = 1;
    }
});

0 个答案:

没有答案