javascript - AngularJS jasmine isolateScope() returns undefined -
i'm expecting isolated scope out of help-button
directive.
it('should contain proper scope, depending on attributes', function() { var el = compile('<help-button context-id="1"></help-button>')(scope); scope.$digest(); console.log("el: " + el); console.log('isolated scope: ' + el.isolatescope()); .. });
-- before each test does
beforeeach(inject(function($compile, $rootscope, $injector) { compile = $compile; scope = $rootscope.$new(); ...
it prints:
'el: [object object]' 'isolated scope: undefined'
the question is: why i'm getting undefined? if there nil in isolated scope, still should empty {} object. anyway - test wrong - not show isolated scope (in real) contains info in there.
i'm stupid.
but reply own question because "a stupid stupid does" - i.e. may 1 1 time same (or myself future).
the problem in helpbutton.html
directive using (which did not show/mention in question).
so templateurl
referring helpbutton.html
file supposed compiled html properly.
once looked @ el.html()
's output got not rendered (there missing tag or something).
thant's why not scope
element
.
(though nice have kind of exception on log if template not rendered html)
javascript angularjs scope jasmine
No comments:
Post a Comment