NathanWalker / nativescript-ngx-fonticon

Use custom font icon collections seamlessly with NativeScript + Angular.
MIT License
75 stars 39 forks source link

Can't find provide module #5

Closed tomylee001001 closed 8 years ago

tomylee001001 commented 8 years ago

Hi ,

I did every step you mention to implement this plugin in my app but i can find the provide module you use in the nativeScriptBootstrap.

roblav96 commented 8 years ago

import it from @angular/core like so:

import {provide} from "@angular/core"

provide(TNSFontIconService, {
    useFactory: () => {
        return new TNSFontIconService({
            'icon': 'css/ionicons-android.css'
        }, true)
    }
})
tomylee001001 commented 8 years ago

thanks.

dondragon2 commented 8 years ago

How does this plugin now work with the final release of angular 2? where provide is not found in @angular/core anymore?

roblav96 commented 8 years ago

@dondragon2 Add it to your providers in your ngModule like so:

providers: [
  { provide: TNSFontIconService,     useFactory: () => {
        return new TNSFontIconService({
            'icon': 'css/ionicons-android.css'
        }, true)
    } }
]

https://angular.io/docs/ts/latest/guide/dependency-injection.html#!#factory-provider