App is console.logging everything twice


#1

When I put console.log into most parts of my controller, in the chrome console it’s saying that’s logging most things twice, as though there were two instances. Any ideas on what would cause this?


#2

you have two states and both have the same controller.

Like

$stateProvider
.state('start', {
    controller: 'test'
})
.state('start.child', {
    controller: 'test'
});

or two views

$stateProvider
.state('start', {
    views: {
        'content': {
            controller: 'test'
        },
        'menu': {
            controller: 'test'
        }
    }
})

or you are using it in your template via ng-controller twice or once in the route definition and another time in the route template with ng-controller.

Or you are reuse the controller as a directive-controller, which is used on the same state where you already instanciated the controller.


#3

Thanks, yeah. Can’t believe it took me this long to figure it out.