angularjs - how to mock ngModel? -


so testing controller, referencing property specified ngmodel in dom. while testing controller, don't have template. whenever $scope.foo.property being accessed in controller, throws error.

in test, can define property before instantiate controller :

it('should mock ng-model', inject(function($rootscope, $controller) {      $rootscope.foo = {         property: 'mock value'     };      $controller('mycontroller', {$scope: $rootscope}); }))); 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -