1
When defining routes, I have the following code:
$stateProvider
.state('app', {
url: '',
abstract: true,
views: {
'login' : { templateUrl: 'view/login.html', controller: 'authentication' },
'navbar-top' : { templateUrl: 'view/navbar-top.html', controller: 'authentication' },
'recover' : { templateUrl: 'view/recover.html', controller: 'authentication' },
'register' : { templateUrl: 'view/register.html', controller: 'authentication' }
}
})
...
I have different views with the same controller.
In the navbar-top.html view I have the "login" and "Register" buttons".
When clicking "login" the "login" view should be changed, but nothing happens because the variables are not changed.
From what I understand, despite having the same controller, the angular create a new instance for each view.
How to reuse and same controller for different views?