I'm using Ionic 2 and my app not work with global providers.
My provider declaration:
@NgModule({
...
providers: [
MyService
]
})
My provider content:
@Injectable()
export class MyService {
...
}
And in my component:
@Component({
...
})
export class MyComponent {
constructor(serviceVariable: MyService) {
serviceVariable.someMethod();
}
}
My ionic info: Cordova CLI: 6.5.0 Ionic Framework Version: 2.3.0 Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.1.4
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.9
Node Version: v6.2.0
Xcode version: Not installed
When i try to use in my application i dont see the provider MyService.
Anyone know why?