@@ -247,20 +247,23 @@ export class MdIcon implements OnChanges, OnInit, AfterViewChecked {
247247 }
248248}
249249
250+ export function ICON_REGISTRY_PROVIDER_FACTORY (
251+ parentRegistry : MdIconRegistry , http : Http , sanitizer : DomSanitizer ) {
252+ return parentRegistry || new MdIconRegistry ( http , sanitizer ) ;
253+ } ;
254+
255+ export const ICON_REGISTRY_PROVIDER = {
256+ // If there is already an MdIconRegistry available, use that. Otherwise, provide a new one.
257+ provide : MdIconRegistry ,
258+ deps : [ [ new Optional ( ) , new SkipSelf ( ) , MdIconRegistry ] , Http , DomSanitizer ] ,
259+ useFactory : ICON_REGISTRY_PROVIDER_FACTORY ,
260+ } ;
250261
251262@NgModule ( {
252263 imports : [ HttpModule , DefaultStyleCompatibilityModeModule ] ,
253264 exports : [ MdIcon , DefaultStyleCompatibilityModeModule ] ,
254265 declarations : [ MdIcon ] ,
255- providers : [ {
256- // If there is already an MdIconRegistry available, use that. Otherwise, provide a new one.
257- provide : MdIconRegistry ,
258- deps : [ [ new Optional ( ) , new SkipSelf ( ) , MdIconRegistry ] , Http , DomSanitizer ] ,
259- useFactory : ( parentRegistry : MdIconRegistry , http : Http , sanitizer : DomSanitizer ) => {
260- return parentRegistry || new MdIconRegistry ( http , sanitizer ) ;
261- } ,
262- }
263- ]
266+ providers : [ ICON_REGISTRY_PROVIDER ] ,
264267} )
265268export class MdIconModule {
266269 /** @deprecated */
0 commit comments