Why using directives with @NgModule ? Introduction to directives with @NgModule - LearnHowToCode SarkariResult.com Interview Questions and Answers LearnHowToCodeOnline
Using directives with @NgModule

Why using directives with @NgModule ? Introduction to directives with @NgModule

Summary: this tutorial will introduce you to the directives with @NgModule  and show you how to apply it to Use the declarations array for directives.
Introduction to directives with @NgModule 
Why using directives with @NgModule ? 
In this article you learn most impotent Use the declarations array for directives. To use a directive, component, or pipe in a module, you must do a few things:
  • Export it from the file where you wrote it.
  • Import it into the appropriate module.
  • Declare it in the @NgModule declarations array.

Those three steps look like the following. In the file where you create your directive, export it. The following example, named ItemDirective is the default directive structure that the CLI generates in its own file, item.directive.ts:

import { Directive } from '@angular/core'; @Directive({ selector: '[appItem]' }) export class ItemDirective { // code goes here constructor() { } }

If Was this tutorial helpful? so please share by social media 

About Mariano

I'm Ethan Mariano a software engineer by profession and reader/writter by passion.I have good understanding and knowledge of AngularJS, Database, javascript, web development, digital marketing and exploring other technologies related to Software development.

0 comments:

Featured post

Political Full Forms List

Acronym Full Form MLA Member of Legislative Assembly RSS Really Simple Syndication, Rashtriya Swayamsevak Sangh UNESCO United Nations E...

Powered by Blogger.