Create a Custom Directives - Let's start to create a simple directive. For more detail kindly refer the link.... I assuming you have installed the Angular CLI and all the necessary configurations are running in your app. Now, go to your project directory and execute the below CLI command for creating your custom directive – ng g directive myCustom After execute the above CLI command, created two files in the project - src/app folder 1. src/app/my-custom.directive.spec.ts 2. src/app/my-custom.directive.ts And update files reference automatically in your project module – “src/app/app.module.ts” Lest see in the code-sample, how it look like- my-custom.directive.ts – import { Directive } from '@angular/core' ; @ Directive ({ selector: '[appMyCustom]' }) export class MyCustomDirective { ...
Angular, React, JavaScript, Java, PHP, SQL, C#, Vue, NodeJs, TypeScript and Interview Questions Answers