我使用angularjs:1.6.5和UI路由器:1.0.3状态更改不点火,但是ui.router工作,否则
主HTML:
<div ng-app="MusicApp" ng-controller="AppCtrl">
<div ng-include="plugins_url + 'templates/sideMenu.html'"></div>
<md-content ng-controller="playlistController">
<div ng-include="plugins_url + 'templates/header.html'"></div>
<div class="all_content" >
<div ng-show="!isHome">
<div ui-view id="other_views" ></div>
</div>
<div ng-include="plugins_url + 'templates/main.html'" ng-show="isHome"></div>
</div>
</md-content>
[etc]
Content from sideMenu.html:
<li><a ui-sref="charter">Home</a></li>
<li><a ui-sref="charter.test">Test</a></li>
我的问题是,基本上没有stateChange的提供工作,我已经试过:$ stateChangeError,$ stateChangeCancel,$ stateChangeStart,$ stateChangeSuccess,就像这样:
$rootScope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState) {
console.log('called')
})
,但它从来没有叫......试过把它放在.config中,在每个控制器中,使用$ scope和/或$ rootScope尝试它,但是nada。
奇怪的是,我认为这是在我的控制台的警告:
angular.min.js?1507208413&ver=4.8.2:123 $route service is not available. Make sure you have included ng-route in your application dependencies.
所以它并不会自动ui.router承认,这当然是加载一个文件,并插入到依赖如'ui.router'。最奇怪的部分是,你可以在sideMenu.html中看到ui-sref工作正常......
是否有可能存在兼容性问题...某处?
感谢任何帮助!
编辑: 我试图与ui.router 0.4.3及以上版本,但它甚至不会启动应用程序...