0

I want to test my form in angular, just like this solution from here. But in my case, I'm using controllerAs (I'm using controller without $scope to reference controller methods) syntax for my controller.

How can I accomplish that?

Community
  • 1
  • 1
  • `controllerAs` still uses `$scope` to bind to the HTML; in the background, your controller is attached to `$scope` as a property. You can still reference `$scope` if it is necessary, but it isn't required to inject the service into the controller. In other words, you would still use `$scope`, and your controller methods would be `$scope.someController.someMethod`. – Claies Aug 04 '16 at 02:49

1 Answers1

1

It will still work exactly the same. The only difference is that you don't need to pass the scope into the construction of the controller but Angular will still bind the form objects to the scope and they can be accessed in the tests exactly the same way.

Adrian Brand
  • 20,384
  • 4
  • 39
  • 60