Reputation: 22745
I try to unit-test my controller with template. I can test it if everything ties to $scope. However, once I use "controller as" syntax, it doesn't work. That make sense because now everything ties to controller. But how to make it work then ?
I use Jasmine with Karma as my test environment.
Upvotes: 2
Views: 123
Reputation: 22745
I figured something out.
Ctrl = $controller('Ctrl as vm', { $scope: $scope });
Upvotes: 0
Reputation: 18065
lets say you have vm
as the controllerAs name. then you can use $scope.vm
to get access to the model
Upvotes: 2