@@ -133,11 +133,6 @@ var COLLECTION_REPEAT_ATTR_WIDTH_ERROR = "collection-repeat expected attribute c
133
133
var COLLECTION_REPEAT_ATTR_REPEAT_ERROR = "collection-repeat expected expression in form of '_item_ in _collection_[ track by _id_]' but got '%'" ;
134
134
135
135
IonicModule
136
- . directive ( {
137
- ngSrc : collectionRepeatSrcDirective ( 'ngSrc' , 'src' ) ,
138
- ngSrcset : collectionRepeatSrcDirective ( 'ngSrcset' , 'srcset' ) ,
139
- ngHref : collectionRepeatSrcDirective ( 'ngHref' , 'href' )
140
- } )
141
136
. directive ( 'collectionRepeat' , [
142
137
'$collectionRepeatManager' ,
143
138
'$collectionDataSource' ,
@@ -263,7 +258,12 @@ function($collectionRepeatManager, $collectionDataSource, $parse) {
263
258
} ) ;
264
259
}
265
260
} ;
266
- } ] ) ;
261
+ } ] )
262
+ . directive ( {
263
+ ngSrc : collectionRepeatSrcDirective ( 'ngSrc' , 'src' ) ,
264
+ ngSrcset : collectionRepeatSrcDirective ( 'ngSrcset' , 'srcset' ) ,
265
+ ngHref : collectionRepeatSrcDirective ( 'ngHref' , 'href' )
266
+ } ) ;
267
267
268
268
// Fix for #1674
269
269
// Problem: if an ngSrc or ngHref expression evaluates to a falsy value, it will
@@ -277,13 +277,11 @@ function collectionRepeatSrcDirective(ngAttrName, attrName) {
277
277
return [ function ( ) {
278
278
return {
279
279
priority : '99' , // it needs to run after the attributes are interpolated
280
- link : function ( scope , element , attr , collectionRepeatCtrl ) {
281
- if ( ! collectionRepeatCtrl ) return ;
280
+ link : function ( scope , element , attr ) {
282
281
attr . $observe ( ngAttrName , function ( value ) {
283
- element [ 0 ] [ attr ] = '' ;
284
- setTimeout ( function ( ) {
285
- element [ 0 ] [ attr ] = value ;
286
- } ) ;
282
+ if ( ! value ) {
283
+ element [ 0 ] . removeAttribute ( attrName ) ;
284
+ }
287
285
} ) ;
288
286
}
289
287
} ;
0 commit comments