我需要使用在JQuery脚本中定义的数组,该数组位于angularJS控制器脚本中。我不明白$rootScope是怎么融入这件事的。
这可能吗,有什么建议吗?
$(document).ready(function(){
$.get("KIP.xml",{},function(xml){
// I need this accessible in controller.js
FinalP = [ ];
}
})。。
var app = angular.module("KIdash", []);
app.controller("controller", function($scope, $rootScope, $http) {
console.log('initilaized!');
$scope.PlayerList = **FinalP**
});发布于 2016-03-30 21:03:16
您可以使用$window对象https://docs.angularjs.org/api/ng/service/$window传递变量。
在Jquery window.FinalP = []中
角$scope.SomeVar = $window.FinalP
https://stackoverflow.com/questions/36319582
复制相似问题