是否可以使用离子与ui-router.stateHelper
我想用它来帮助我处理嵌套视图:
属性children
是我正在寻找的。
如果不可能,我怎么能做类似的事情,而不用名称parent.child
定义每个子状态?
安装并导入后获取下一个错误:
TypeError: Cannot read property '@' of undefined at updateView (http://localhost:8100/lib/ionic/js/ionic.bundle.js:62199:69)
at http://localhost:8100/lib/ionic/js/ionic.bundle.js:62194:9
at invokeLinkFn (http://localhost:8100/lib/ionic/js/ionic.bundle.js:21830:9)
at nodeLinkFn (http://localhost:8100/lib/ionic/js/ionic.bundle.js:21330:11)
at compositeLinkFn (http://localhost:8100/lib/ionic/js/ionic.bundle.js:20721:13)
at compositeLinkFn (http://localhost:8100/lib/ionic/js/ionic.bundle.js:20725:13)
at compositeLinkFn (http://localhost:8100/lib/ionic/js/ionic.bundle.js:20725:13)
at publicLinkFn (http://localhost:8100/lib/ionic/js/ionic.bundle.js:20596:30)
at http://localhost:8100/lib/ionic/js/ionic.bundle.js:14815:27
at Scope.$eval (http://localhost:8100/lib/ionic/js/ionic.bundle.js:29026:28) <ion-nav-view class="view-container" nav-view-transition="ios">
答案 0 :(得分:1)
好的,这是有效的..我对注射有问题。 这是正确的方法:(我正在使用browserify)
npm install angular-ui-router.statehelper
然后在package.json
在browser
下:
"angular-ui-router-helper": "./node_modules/angular-ui-router.statehelper/statehelper.min.js"
并在browserify-shim
下
"browserify-shim": {
"angular": "angular",
"ionic": "ionic",
"angular-ui-router-helper": {
"exports": "angular.module('ui.router.stateHelper')"
}
},
然后在index.js中:
var rootModule = angular.module('AppName', ['ionic',require('angular-ui-router-helper').name]);
然后你可以将stateHelperProvider
注入配置方法:)