how to know the template exist or not?

http://stackoverflow.com/questions/30703179/how-to-test-existence-of-template-in-templatecache

describe('The popup template', function() {

    var $templateCache;
    beforeEach(inject(function($injector) {
        $templateCache = $injector.get('$templateCache');
    });

    it('should use a template that exists', function() {
        // If you are using something such as chai
        expect($templateCache.get('your/template/url.html')).to.be.ok;

        // If you aren't use an assertion library
        if (!$templateCache.get('your/template/url.html')) {
            throw new Error('Template does not exist');
        }
    });
});
Advertisements
This entry was posted in Angularjs. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s