angularjs - Angular could not resolve from state -
i used jhipster generate app , tried add 2 different types of forms, both use same entity (one wouldn't use fields in entity , other use all).
now, works alright for:
.state('xyz', { parent: 'entity', url: '/xyz', data: { authorities: ['role_user'], pagetitle: 'xyzs' }, views: { 'content@': { templateurl: 'app/entities/xyz/xyzs.html', controller: 'xyzcontroller', controlleras: 'vm' } }, resolve: { } }).state('xyz.new', { parent: 'xyz', url: '/new', data: { authorities: ['role_user'] }, onenter: ['$stateparams', '$state', '$uibmodal', function($stateparams, $state, $uibmodal) { $uibmodal.open({ templateurl: 'app/entities/xyz/xyz-dialog.html', controller: 'xyzdialogcontroller', controlleras: 'vm', backdrop: 'static', size: 'lg', resolve: { entity: function () { return { ... }; } } }).result.then(function() { $state.go('xyz', null, { reload: true }); }, function() { $state.go('xyz'); }); }] })
and works alright, if change small bit , use:
.state('xyz', { parent: 'entity', url: '/xyz', data: { authorities: ['role_user'], pagetitle: 'xyzs' }, views: { 'content@': { templateurl: 'app/entities/xyz/xyzs.html', controller: 'xyzcontroller', controlleras: 'vm' } }, resolve: { } }).state('a-xyz.new', { parent: 'xyz', url: '/a/new', data: { authorities: ['role_user'] }, onenter: ['$stateparams', '$state', '$uibmodal', function($stateparams, $state, $uibmodal) { $uibmodal.open({ templateurl: 'app/entities/xyz/a-xyz-dialog.html', controller: 'xyzdialogcontroller', controlleras: 'vm', backdrop: 'static', size: 'lg', resolve: { entity: function () { return { ... }; } } }).result.then(function() { $state.go('xyz', null, { reload: true }); }, function() { $state.go('xyz'); }); }] })
and i've change ui-sref="xyz.new"
ui-sref="a-xyz.new"
in html template
i'm getting error:
error: not resolve 'a-xyz.new' state 'xyz' transitionto@http://localhost:9000/bower_components/angular-ui-router/release/angular-ui-router.js:3180:17 go@http://localhost:9000/bower_components/angular-ui-router/release/angular-ui-router.js:3108:14 clickhook/</transition<@http://localhost:9000/bower_components/angular-ui-router/release/angular-ui-router.js:4158:9 timeout/timeoutid<@http://localhost:9000/bower_components/angular/angular.js:19157:28 completeoutstandingrequest@http://localhost:9000/bower_components/angular/angular.js:5869:7 browser/self.defer/timeoutid<@http://localhost:9000/bower_components/angular/angular.js:6145:7
the dot notation used indicate child state parent state. may refer link better understanding of nested views/states.
go through this:
one parent can have multiple child states. so, if parent state 'xyz', can multiple child states 'xyz.a', 'xyz.b', 'xyz.c' etc.
Comments
Post a Comment