|
83 | 83 | var locals = angular.extend({}, segment.locals),
|
84 | 84 | template = locals && locals.$template;
|
85 | 85 |
|
86 |
| - if (template) { |
87 |
| - |
88 |
| - clearContent(); |
89 |
| - |
90 |
| - currentElement = tElement.clone(); |
91 |
| - currentElement.html(template); |
92 |
| - animate.enter( currentElement, null, anchor ); |
93 |
| - |
94 |
| - var link = $compile(currentElement, false, 499), controller; |
95 |
| - |
96 |
| - currentScope = $scope.$new(); |
97 |
| - if (segment.params.controller) { |
98 |
| - locals.$scope = currentScope; |
99 |
| - controller = $controller(segment.params.controller, locals); |
100 |
| - if(segment.params.controllerAs) |
101 |
| - currentScope[segment.params.controllerAs] = controller; |
102 |
| - currentElement.data('$ngControllerController', controller); |
103 |
| - currentElement.children().data('$ngControllerController', controller); |
104 |
| - } |
105 |
| - |
106 |
| - link(currentScope); |
107 |
| - currentScope.$emit('$viewContentLoaded'); |
108 |
| - currentScope.$eval(onloadExp); |
109 |
| - } else { |
110 |
| - clearContent(); |
| 86 | + clearContent(); |
| 87 | + |
| 88 | + currentElement = tElement.clone(); |
| 89 | + currentElement.html(template ? template : defaultContent); |
| 90 | + animate.enter( currentElement, null, anchor ); |
| 91 | + |
| 92 | + var link = $compile(currentElement, false, 499), controller; |
| 93 | + |
| 94 | + currentScope = $scope.$new(); |
| 95 | + if (segment.params.controller) { |
| 96 | + locals.$scope = currentScope; |
| 97 | + controller = $controller(segment.params.controller, locals); |
| 98 | + if(segment.params.controllerAs) |
| 99 | + currentScope[segment.params.controllerAs] = controller; |
| 100 | + currentElement.data('$ngControllerController', controller); |
| 101 | + currentElement.children().data('$ngControllerController', controller); |
111 | 102 | }
|
| 103 | + |
| 104 | + link(currentScope); |
| 105 | + currentScope.$emit('$viewContentLoaded'); |
| 106 | + currentScope.$eval(onloadExp); |
112 | 107 | }
|
113 | 108 | }
|
114 | 109 | }
|
|
0 commit comments