vendredi 6 mai 2016

karma compiled element is empty

I have a simple directive with a templateUrl statement, I'm using ng-html2js to load the template. I compiled the element and call the $digest method, but the element is empty or its html() is ''.

This is the test:

var scope, element;

beforeEach(module('mainApp'));
beforeEach(module('templates/about.html'));

beforeEach(inject(function($rootScope, $compile) {
    element = angular.element('<about-modal></about-modal>');

    scope = $rootScope;
    $compile(element)(scope);
    scope.$digest();
}));


it('About widget is loaded', function () {
    expect(element.html()).toEqual('<some html>');
});

It is like the element is not digested or populated. Has the same status before is compiled and digested.

Aucun commentaire:

Enregistrer un commentaire