How can I access a scope variable of a directive while writing the jasmine test cases, also I am getting the error of unexpected Get request? -


i wanted access scope variables of directive while writing jasmine test case.i wrote fallowing code , worked.

element = angular.element('<div ex-upgrading-user-info></div>'); $compile(element)($rootscope.$new()); $rootscope.$digest(); scope = element.isolatescope() || element.scope(); 

but issue have services getting called inside link function of directive again creates request data api. when directive in test case getting compiled shows error:

error: unexpected request: /url/controller/service?actiontype=selectedline no more request expected.....

so solve used:

$httpbackend.whenget("/url/controller/service?actiontype=selectedline").respond(200,"hello"); 

in beforeeach function above code directive compiled. solved problem of unexpected request again not able access my
scope variables of directive. please suggest.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -