I have some custom directive which i need to use in whole application. How to register my directives to use in whole application? Other questions I came across are all outdated. I need solution for angular 2 final version 2.1.0
my main.ts
looks like this
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';
//enableProdMode(); //Uncomment for production
platformBrowserDynamic().bootstrapModule(AppModule)
.then((success: any) => console.log('App bootstrapped'))
.catch((err: any) => console.error(err));
My app have 6 modules to use lazy oading
appmodule
--contact module
--project module
--restmodules
...
When I registered the directive in product module, it worked well. So I used this directive in my rest of modules for which I registered this directive in appmodule.ts
like this
import { mdinput} from './shared/mdinput.directive';
@NgModule({
imports: [
AppRoutingModule
],
declarations: [
AppComponent,mdinput
],
providers: [DataService],
bootstrap: [AppComponent]
})
export class AppModule {
}
now this particular directive is not working. Nor is it giving any errors.