Testing element directive - can't access isolated scope methods during tests

前端 未结 2 1056
渐次进展
渐次进展 2020-12-29 05:40

I have the following directive.

directivesModule.directive(\'wikis\', function() {
var urlRegex = new RegExp(\'^(https?)://.+$\');

return {
    restrict: \         


        
2条回答
  •  不知归路
    2020-12-29 06:09

    As per angular 1.2.0 docs, the way to get the isolate scope is through the method isolateScope

    • scope() - retrieves the scope of the current element or its parent.

    • isolateScope() - retrieves an isolate scope if one is attached directly to the current element. This getter should be used only on elements that contain a directive which starts a new isolate scope. Calling scope() on this element always returns the original non-isolate scope.

    Angular doc - section jQuery/jqLite Extras

    BREAKING CHANGE: jqLite#scope()

提交回复
热议问题