File tree Expand file tree Collapse file tree 2 files changed +7
-10
lines changed
Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -87,10 +87,9 @@ export function ngIncludeDirective(
8787 const thisChangeId = ++ changeCounter ;
8888
8989 if ( src ) {
90- // set the 2nd param to true to ignore the template request error so that the inner
91- // contents and scope can be cleaned up.
92- await $templateRequest ( src ) . then (
93- ( response ) => {
90+ scope . $emit ( "$includeContentRequested" , src ) ;
91+ $templateRequest ( src )
92+ . then ( ( response ) => {
9493 if ( scope . _destroyed ) return ;
9594
9695 if ( thisChangeId !== changeCounter ) return ;
@@ -121,18 +120,16 @@ export function ngIncludeDirective(
121120 currentElement = clone ;
122121 currentScope . $emit ( "$includeContentLoaded" , src ) ;
123122 scope . $eval ( onloadExp ) ;
124- } ,
125- ( err ) => {
123+ } )
124+ . catch ( ( err ) => {
126125 if ( scope . _destroyed ) return ;
127126
128127 if ( thisChangeId === changeCounter ) {
129128 cleanupLastIncludeContent ( ) ;
130129 scope . $emit ( "$includeContentError" , src ) ;
131130 }
132131 $exceptionHandler ( new Error ( err ) ) ;
133- } ,
134- ) ;
135- scope . $emit ( "$includeContentRequested" , src ) ;
132+ } ) ;
136133 } else {
137134 cleanupLastIncludeContent ( ) ;
138135 ctrl . template = null ;
Original file line number Diff line number Diff line change @@ -329,7 +329,7 @@ describe("ngInclude", () => {
329329 } ) ) ;
330330 EL . innerHTML = "<svg><test></test></svg>" ;
331331 angular . bootstrap ( EL , [ "myModule" ] ) ;
332- getScope ( EL ) . $on ( "$includeContentRequested " , ( ) => {
332+ getScope ( EL ) . $on ( "$includeContentLoaded " , ( ) => {
333333 const child = EL . querySelectorAll ( "rect" ) ;
334334 expect ( child . length ) . toBe ( 2 ) ;
335335 expect ( child [ 0 ] instanceof SVGRectElement ) . toBe ( true ) ;
You can’t perform that action at this time.
0 commit comments