[AngularJS] Taking control of your templates using $templateCache

Using $templateCache for quickly retrieval from the cache after first time used.

 

$templateCache mainly can use two methods:

  • get(id)
  • put(id, "your html code here")

 

angular.module('app', [])
    .directive('myButton', function () {
        return {
            templateUrl: 'timestamp'
        }
    })
    .run(function ($templateCache) {
        $templateCache.put('timestamp', '');
    });

 

or you can but your template in the

你可能感兴趣的:([AngularJS] Taking control of your templates using $templateCache)