$rootScope 和 $route 似乎发生了变化。我不知道如何真正解释它,但希望下面的代码可以解决问题。关于为什么会发生这种情况或我如何解决它的任何建议都会非常有帮助。
控制器 #1:
app.controller('PostCtrl', [
'$scope', 'mainAPIService', 'listFeedService', '$location', '$route', '$routeParams', '$rootScope',
function ($scope, mainAPIService, listFeedService, $route, $routeParams, $rootScope) {
console.log($route)
输出#1:
Jc {$$html5: true, $$protocol: "http", $$host: "company", $$port: 80, $$parse: function…}
$$absUrl: "http://company/post/943/comments"
$$compose: function (){var a=Db(this.$$search),b=this.$$hash?"#"+kb(this.$$hash):"";this.$$url=Qb(this.$$path)+ (a?"?"+a:"")+b;this.$$absUrl=c+this.$$url.substr(1)}
$$hash: ""
$$host: "company"
$$html5: true
$$parse: function (a){var e=na(c,a);if(!y(e))throw S b("ipthprfx",a,c);Ic(e,this,b);this.$$path||
$$path: "/post/943/comments"
$$port: 80
$$protocol: "http"
$$replace: false
$$rewrite: function (d){var e;if((e=na(b,d))!==r)return d=e,(e=na(a,e))!==r?c+ (na("/",e)||e):b+d;if((e=na(c,d))!==r)return c+e;if(c==d+"/")return c}
$$search: Object
$$url: "/post/943/comments"
__proto__: Object
控制器 #2:
app.controller('FeedCtrl', [
'$scope', 'ajaxService', '$location', '$route', '$routeParams', '$interval', '$rootScope',
function ($scope, ajaxService, $location, $route, $routeParams, $interval, $rootScope) {
console.log($route)
输出#2:
Object {routes: Object, reload: function}
current: e.extend.e.extend
reload: function (){u=!0;a.$evalAsync(l)}
routes: Object
__proto__: Object
app.js:181