亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

How angular.js receives data passed from the background
淡淡煙草味
淡淡煙草味 2017-05-15 17:13:34
0
3
772

I encountered a problem in the TP project. The front-end page is a list implemented with angular.js. I first passed the background json array to the page:
//ag configuration information
var ag_data = {};
ag_data.address = '{$address}';
ag_data.url = "{:U('')}";
console.log(ag_data.url);
Then a js file is referenced at the bottom of the page, which contains a logic written in angular.js. I pass it in the page You can get the url in the js file, but you can't get it in the controller

The error printed by the browser is like this

How to pass external values ????to the scope of angular. . .
I am a newbie, please give some guidance╮(╯▽╰)╭

淡淡煙草味
淡淡煙草味

reply all(3)
世界只因有你

https://docs.angularjs.org/er...$injector/unpr?p0=$applyProvider%20%3C-%20$apply%20%3C-%20localCon
I suspect that your localCon controller has Question

You try changing the controller to this way

angular.module('myApp', [])
.controller('MyController', ['myService', function (myService) {
  // Do something with myService
}]);
漂亮男人

The error message has already told you that the instance method in apply 那里有問題。因為 $apply$scope cannot be injected directly here. .

You just write:

app.controler('localCon', function ($scope, $timeout, $http) {});

That should be enough. These three are all built-in services of AngularJS, so there is no problem in injecting them explicitly without brackets.

Peter_Zhu

Change $http.post to $http.get

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template