2

I have the following states declaration (angular v1.5.5):

$stateProvider
    .state('appPublic', {
        abstract: true,
        data: { restricted : false }
    })
    .state('home', {
        url: '/',
        parent: 'appPublic',
        templateUrl: 'app/views/main.html',
        controller: 'mainCtrl'
    });

When I open my site, I don't see the main html content (the home state). But, when I remove the parent: 'appPublic' declaration - it works then. So, why I can't to specify the state's parent ?

Radim Köhler
  • 117,533
  • 47
  • 231
  • 321
Tony
  • 11,443
  • 32
  • 119
  • 213

3 Answers3

3

Every parent, must provide a view target for its child (if using unnamed views are used, i.e parent is not skipped with absolute view naming - Angularjs ui-router not reaching child controller). So this should work

.state('appPublic', {
     abstract: true,
     data: { restricted : false },
     template: '<div ui-view=""></div'
 })

now, child view (unnamed view) will be placed in the ui-view target, declared in parent's template

Community
  • 1
  • 1
Radim Köhler
  • 117,533
  • 47
  • 231
  • 321
2

try this:

 $routeProvider.when('/userLogin',
                            {
                                templateUrl: 'WebrtcLogin.html',
                                controller: 'UserLoginController'
                            })
aditya shrivastava
  • 684
  • 1
  • 7
  • 20
0

ok, I needed to include template: '<ui-view/>' in my abstract state. The answer is here https://stackoverflow.com/a/33181762/106616

Community
  • 1
  • 1
Tony
  • 11,443
  • 32
  • 119
  • 213