0
    .state('app.match.indicator.speciality',{
      url: '/speciality/:jobId?',
      views: {
        '[email protected]':{
          templateUrl: ENVApp + '/views/match/match.roleProfileSideBar.html?' + cacheVersion,
        },
        '[email protected]': {
          templateUrl: ENVApp + '/views/match/match.page2.html?' + cacheVersion
        }
      },
      controller: 'RoleProfileCreateSpecialtyController'
    })

That's what I have as a state definition, however my RoleProfileCreateSpecialtyController doesn't get loaded for some reason. I know this because I threw an alert in there that never happens.

What am I doing wrong?

This also fails:

    .state('app.match.indicator.speciality',{
      url: '/speciality/:jobId?',
      views: {
        '[email protected]':{
          templateUrl: ENVApp + '/views/match/match.roleProfileSideBar.html?' + cacheVersion,
        },
        '[email protected]': {
          templateUrl: ENVApp + '/views/match/match.page2.html?' + cacheVersion
        }
      },
      // controller: 'RoleProfileCreateSpecialityController'
      controller: function() {
        alert('fd')
      }
    })
10
  • Remove the quotes around the controller name. I'm assuming your importing it, too? Commented Dec 8, 2016 at 15:34
  • Then you probably have console errors like 'cannot find controller' Commented Dec 8, 2016 at 15:36
  • That doesn't do it. Even if I put a controller name that doesn't exist, I get no error Commented Dec 8, 2016 at 15:39
  • Have you loaded this state configuration js? Commented Dec 8, 2016 at 15:41
  • Yes - when I go to this route, the views load fine Commented Dec 8, 2016 at 15:43

1 Answer 1

2

When defining multiple views in a state, you cannot define a single controller (see https://stackoverflow.com/a/33139917/3153169 for reference).

To fix this, you can just define the controller for the multiple views:

.state('app.match.indicator.speciality',{
    url: '/speciality/:jobId?',
    views: {
        '[email protected]':{
            templateUrl: ENVApp + '/views/match/match.roleProfileSideBar.html?' + cacheVersion,
            controller: 'RoleProfileCreateSpecialtyController'
        },
        '[email protected]': {
            templateUrl: ENVApp + '/views/match/match.page2.html?' + cacheVersion,
            controller: 'RoleProfileCreateSpecialtyController'
        }
    }
})
Sign up to request clarification or add additional context in comments.

1 Comment

As an addendum for the OP : read this link in the answer link by devqon : stackoverflow.com/q/29107012/1679310. You will probably need it.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.