@@ -39,7 +39,7 @@ describe('ngView', function() {
39
39
} ;
40
40
} ) ;
41
41
42
- $routeProvider . when ( '/some' , { template : '/tpl.html' , controller : Ctrl } ) ;
42
+ $routeProvider . when ( '/some' , { templateUrl : '/tpl.html' , controller : Ctrl } ) ;
43
43
} ) ;
44
44
45
45
inject ( function ( $route , $rootScope , $templateCache , $location ) {
@@ -59,7 +59,7 @@ describe('ngView', function() {
59
59
60
60
module ( function ( $controllerProvider , $routeProvider ) {
61
61
$controllerProvider . register ( 'MyCtrl' , [ '$scope' , MyCtrl ] ) ;
62
- $routeProvider . when ( '/foo' , { controller : 'MyCtrl' , template : '/tpl.html' } ) ;
62
+ $routeProvider . when ( '/foo' , { controller : 'MyCtrl' , templateUrl : '/tpl.html' } ) ;
63
63
} ) ;
64
64
65
65
inject ( function ( $route , $location , $rootScope , $templateCache ) {
@@ -75,8 +75,8 @@ describe('ngView', function() {
75
75
76
76
it ( 'should load content via xhr when route changes' , function ( ) {
77
77
module ( function ( $routeProvider ) {
78
- $routeProvider . when ( '/foo' , { template : 'myUrl1' } ) ;
79
- $routeProvider . when ( '/bar' , { template : 'myUrl2' } ) ;
78
+ $routeProvider . when ( '/foo' , { templateUrl : 'myUrl1' } ) ;
79
+ $routeProvider . when ( '/bar' , { templateUrl : 'myUrl2' } ) ;
80
80
} ) ;
81
81
82
82
inject ( function ( $rootScope , $compile , $httpBackend , $location , $route ) {
@@ -97,9 +97,34 @@ describe('ngView', function() {
97
97
} ) ;
98
98
99
99
100
+ it ( 'should use inline content route changes' , function ( ) {
101
+ module ( function ( $routeProvider ) {
102
+ $routeProvider . when ( '/foo' , { template : '<div>{{1+3}}</div>' } ) ;
103
+ $routeProvider . when ( '/bar' , { template : 'angular is da best' } ) ;
104
+ $routeProvider . when ( '/blank' , { template : '' } ) ;
105
+ } ) ;
106
+
107
+ inject ( function ( $rootScope , $compile , $location , $route ) {
108
+ expect ( element . text ( ) ) . toEqual ( '' ) ;
109
+
110
+ $location . path ( '/foo' ) ;
111
+ $rootScope . $digest ( ) ;
112
+ expect ( element . text ( ) ) . toEqual ( '4' ) ;
113
+
114
+ $location . path ( '/bar' ) ;
115
+ $rootScope . $digest ( ) ;
116
+ expect ( element . text ( ) ) . toEqual ( 'angular is da best' ) ;
117
+
118
+ $location . path ( '/blank' ) ;
119
+ $rootScope . $digest ( ) ;
120
+ expect ( element . text ( ) ) . toEqual ( '' ) ;
121
+ } ) ;
122
+ } ) ;
123
+
124
+
100
125
it ( 'should remove all content when location changes to an unknown route' , function ( ) {
101
126
module ( function ( $routeProvider ) {
102
- $routeProvider . when ( '/foo' , { template : 'myUrl1' } ) ;
127
+ $routeProvider . when ( '/foo' , { templateUrl : 'myUrl1' } ) ;
103
128
} ) ;
104
129
105
130
inject ( function ( $rootScope , $compile , $location , $httpBackend , $route ) {
@@ -118,7 +143,7 @@ describe('ngView', function() {
118
143
119
144
it ( 'should chain scopes and propagate evals to the child scope' , function ( ) {
120
145
module ( function ( $routeProvider ) {
121
- $routeProvider . when ( '/foo' , { template : 'myUrl1' } ) ;
146
+ $routeProvider . when ( '/foo' , { templateUrl : 'myUrl1' } ) ;
122
147
} ) ;
123
148
124
149
inject ( function ( $rootScope , $compile , $location , $httpBackend , $route ) {
@@ -140,7 +165,7 @@ describe('ngView', function() {
140
165
it ( 'should be possible to nest ngView in ngInclude' , function ( ) {
141
166
142
167
module ( function ( $routeProvider ) {
143
- $routeProvider . when ( '/foo' , { template : 'viewPartial.html' } ) ;
168
+ $routeProvider . when ( '/foo' , { templateUrl : 'viewPartial.html' } ) ;
144
169
} ) ;
145
170
146
171
inject ( function ( $httpBackend , $location , $route , $compile , $rootScope ) {
@@ -156,7 +181,7 @@ describe('ngView', function() {
156
181
$httpBackend . flush ( ) ;
157
182
158
183
expect ( elm . text ( ) ) . toEqual ( 'include: view: content' ) ;
159
- expect ( $route . current . template ) . toEqual ( 'viewPartial.html' ) ;
184
+ expect ( $route . current . templateUrl ) . toEqual ( 'viewPartial.html' ) ;
160
185
dealoc ( elm )
161
186
} ) ;
162
187
} ) ;
@@ -170,7 +195,7 @@ describe('ngView', function() {
170
195
}
171
196
172
197
module ( function ( $routeProvider ) {
173
- $routeProvider . when ( '/foo' , { controller : ParentCtrl , template : 'viewPartial.html' } ) ;
198
+ $routeProvider . when ( '/foo' , { controller : ParentCtrl , templateUrl : 'viewPartial.html' } ) ;
174
199
} ) ;
175
200
176
201
@@ -209,8 +234,8 @@ describe('ngView', function() {
209
234
// this is a test for a bad race condition that affected feedback
210
235
211
236
module ( function ( $routeProvider ) {
212
- $routeProvider . when ( '/foo' , { template : 'myUrl1' } ) ;
213
- $routeProvider . when ( '/bar' , { template : 'myUrl2' } ) ;
237
+ $routeProvider . when ( '/foo' , { templateUrl : 'myUrl1' } ) ;
238
+ $routeProvider . when ( '/bar' , { templateUrl : 'myUrl2' } ) ;
214
239
} ) ;
215
240
216
241
inject ( function ( $route , $rootScope , $location , $httpBackend ) {
@@ -231,7 +256,7 @@ describe('ngView', function() {
231
256
232
257
it ( 'should be async even if served from cache' , function ( ) {
233
258
module ( function ( $routeProvider ) {
234
- $routeProvider . when ( '/foo' , { controller : noop , template : 'myUrl1' } ) ;
259
+ $routeProvider . when ( '/foo' , { controller : noop , templateUrl : 'myUrl1' } ) ;
235
260
} ) ;
236
261
237
262
inject ( function ( $route , $rootScope , $location , $templateCache ) {
@@ -262,7 +287,7 @@ describe('ngView', function() {
262
287
} ;
263
288
264
289
module ( function ( $routeProvider ) {
265
- $routeProvider . when ( '/foo' , { template : 'tpl.html' , controller : Ctrl } ) ;
290
+ $routeProvider . when ( '/foo' , { templateUrl : 'tpl.html' , controller : Ctrl } ) ;
266
291
} ) ;
267
292
268
293
inject ( function ( $templateCache , $rootScope , $location ) {
@@ -282,7 +307,7 @@ describe('ngView', function() {
282
307
283
308
it ( 'should destroy previous scope' , function ( ) {
284
309
module ( function ( $routeProvider ) {
285
- $routeProvider . when ( '/foo' , { template : 'tpl.html' } ) ;
310
+ $routeProvider . when ( '/foo' , { templateUrl : 'tpl.html' } ) ;
286
311
} ) ;
287
312
288
313
inject ( function ( $templateCache , $rootScope , $location ) {
@@ -319,8 +344,8 @@ describe('ngView', function() {
319
344
} ;
320
345
321
346
module ( function ( $routeProvider ) {
322
- $routeProvider . when ( '/one' , { template : 'one.html' , controller : createCtrl ( 'ctrl1' ) } ) ;
323
- $routeProvider . when ( '/two' , { template : 'two.html' , controller : createCtrl ( 'ctrl2' ) } ) ;
347
+ $routeProvider . when ( '/one' , { templateUrl : 'one.html' , controller : createCtrl ( 'ctrl1' ) } ) ;
348
+ $routeProvider . when ( '/two' , { templateUrl : 'two.html' , controller : createCtrl ( 'ctrl2' ) } ) ;
324
349
} ) ;
325
350
326
351
inject ( function ( $httpBackend , $rootScope , $location ) {
@@ -368,9 +393,9 @@ describe('ngView', function() {
368
393
}
369
394
370
395
module ( function ( $routeProvider ) {
371
- $routeProvider . when ( '/bar' , { template : 'tpl.html' , controller : createController ( 'bar' ) } ) ;
396
+ $routeProvider . when ( '/bar' , { templateUrl : 'tpl.html' , controller : createController ( 'bar' ) } ) ;
372
397
$routeProvider . when ( '/foo' , {
373
- template : 'tpl.html' , controller : createController ( 'foo' ) , reloadOnSearch : false } ) ;
398
+ templateUrl : 'tpl.html' , controller : createController ( 'foo' ) , reloadOnSearch : false } ) ;
374
399
} ) ;
375
400
376
401
inject ( function ( $templateCache , $location , $rootScope ) {
@@ -393,7 +418,7 @@ describe('ngView', function() {
393
418
394
419
it ( 'should evaluate onload expression after linking the content' , function ( ) {
395
420
module ( function ( $routeProvider ) {
396
- $routeProvider . when ( '/foo' , { template : 'tpl.html' } ) ;
421
+ $routeProvider . when ( '/foo' , { templateUrl : 'tpl.html' } ) ;
397
422
} ) ;
398
423
399
424
inject ( function ( $templateCache , $location , $rootScope ) {
@@ -414,7 +439,7 @@ describe('ngView', function() {
414
439
}
415
440
416
441
module ( function ( $routeProvider ) {
417
- $routeProvider . when ( '/foo' , { template : 'tpl.html' , controller : MyCtrl } ) ;
442
+ $routeProvider . when ( '/foo' , { templateUrl : 'tpl.html' , controller : MyCtrl } ) ;
418
443
} ) ;
419
444
420
445
inject ( function ( $templateCache , $location , $rootScope , $route ) {
0 commit comments