Monday, December 30, 2019

What is restrict option in directive?

The restrict option in angular directive, is used to specify how a directive will be invoked in your angular app i.e. as an attribute, class, element or comment.

There are four valid options for restrict:

'A' (Attribute)- <span my-directive></span>

'C' (Class)- <span class="my-directive:expression;"></span> 'E' (Element)- <my-directive></my-directive>

'M' (Comment)- <!-- directive: my-directive expression -->

What are the new features introduced in Angular 5?


Angular 5 came with a lot of new features which help and attract developer at any point of time on Angular specific task. It also has some earlier bug fixing which also helps angular developer for smooth coding.

AOT feature is making as a default feature.
  • 1.       Activating watching mode which helps developer especially in debug.
  • 2.       Introducing type checking utility for the template.
  • 3.       Metadata saving and fetching utility making more advance which makes it more flexible.
  • 4.       Unwanted ts file like *.ngfactory.ts has been removed permanently.
  • 5.       Displaying error message are more meaningful which help angular developer on error investigation.
  • 6.       Feature upgrades are more smooth then earlier.
  • 7.       Introducing new Tree shakeable components help angular developer for a new feature.
  • 8.       More advance in case of Hybrid upgrade application.
  • 9.       Improve their performance more than earlier versions.


What are the key components of Angular?
Angular has the below key components,
  • 1.       Component: These are the basic building blocks of angular application to control HTML views.
  • 2.       Modules: An angular module is set of angular basic building blocks like component, directives, services etc. An application is divided into logical pieces and each piece of code is called as "module" which perform a single task.
  • 3.       Templates: This represent the views of an Angular application.
  • 4.       Services: It is used to create components which can be shared across the entire application.
  • 5.       Metadata: This can be used to add more data to an Angular class.


What is restrict option in directive?

The restrict option in angular directive, is used to specify how a directive will be invoked in your angular app i.e. as an attribute, class...