bastion 3.2.2 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@
2
2
  (function () {
3
3
  'use strict';
4
4
 
5
- function extendTemplate($templateCache, $compile, $http, $q, $log) {
5
+ function extendTemplate($templateCache, $compile, $http, $q, $log, $timeout) {
6
6
 
7
7
  function warnMissingBlock(name, src) {
8
8
  $log.warn('Failed to find data-block=' + name + ' in ' + src);
@@ -14,6 +14,7 @@
14
14
  if (!src) {
15
15
  throw 'Template not specified in extend-template directive';
16
16
  }
17
+
17
18
  // Clone and then clear the template element to prevent expressions from being evaluated
18
19
  var $clone = tElement.clone();
19
20
  tElement.html('');
@@ -66,8 +67,12 @@
66
67
 
67
68
  return function ($scope, $element) {
68
69
  loadTemplate.then(function ($template) {
70
+ $scope.$broadcast('$blocksExtendTemplateLinkStart', src);
69
71
  $element.html($template.html());
70
72
  $compile($element.contents())($scope);
73
+ $timeout(function () {
74
+ $scope.$broadcast('$blocksExtendTemplateLinkFinish', src);
75
+ });
71
76
  });
72
77
  };
73
78
  }
@@ -75,5 +80,5 @@
75
80
  }
76
81
 
77
82
  angular.module('angular-blocks', [])
78
- .directive('extendTemplate', ['$templateCache', '$compile', '$http', '$q', '$log', extendTemplate]);
83
+ .directive('extendTemplate', ['$templateCache', '$compile', '$http', '$q', '$log', '$timeout', extendTemplate]);
79
84
  }());