javascript - Testing an Angular directive with isolate scope data -
i have angularjs directive reads input data it's attributes, this:
<my-directive input-data='items'></my-directive>
my directive:
return { scope: { inputdata: '=' } } ...
now, define nested array of objects in scope , directive reads data scope, i'm trying make jasmine, grunt , angular play nicely directive can test it, i'm getting error:
error: [$compile:nonassign] expression 'undefined' used directive 'angularmultiselect' non-assignable!
this how i'm trying inject data in jasmine test:
inject(function($compile, $rootscope) { scope = $rootscope.$new(); //scope.items = []; //<--- works, it's useless scope.items = [{}, {}]; //<---- triggers error (i haven't deleted anything, array 2 empty objects elem = angular.element(html); $compile(elem)(scope); scope.$digest(); });
how supposed pass data, jasmine, directive?
my problem directive trying bind model data non-existing variable in scope of jasmine.
Comments
Post a Comment