javascript - AngularJS testing directives with templateUrl -


I'm trying to use the AngularJS instructions to test. But I'm running into problems with templateUrls. Using the described technique, it also turns stranger, it works as an ad and loads my template in the $ template cache, but that cache is not being used by directing here. :

This will work just fine

 . Replace: correct, link: function () {console}, replace ('message composer', function ($ template cache), {replace {restricted: 'e', ​​template: $ TemplateCache.get ('partials / message_composer.html') .log ('hello world');}};});  

But as soon as I use a templateUrl, it fails to be bound to test:

  .directive ('messageComposer', function () {Return {restricted: 'e', ​​template url: 'partial / message_composer html', replace: correct, link: function () {console.log ('hello world');}};});  

Does anybody know what's going on here?

Here is my unit test setup:

  var $ scope; Var $ Collection; First (each (function (modules ('partial / message_computer' html); module ('messagecommand'); injection (function (_ $ compile_, $ rootScope) {$ scope = $ root.Scope. $ New (); $ Compile = _ $ Compile_;});}); ("works", function () {$ scope.message = {}; elem = angular.element ("& lt; message-composer message = 'message '& Gt; & lt; / message-composer & gt; "$) $ compilation" ($ scope); console.log (elem); Hopefully (true) .toBeDefined ();}); According to Url , I believe that you have run the following command:  

Hopefully, the following files will give you better explanations:


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -