An unhandled exception occurred: Cannot find module 'domelementtype'
[ng] Require stack:
Solution
Step 1: Delete node_modules folder
Step 2 : npm install
Step 3 : start server
Step 4 : enjoy
An unhandled exception occurred: Cannot find module 'domelementtype'
[ng] Require stack:
Solution
Step 1: Delete node_modules folder
Step 2 : npm install
Step 3 : start server
Step 4 : enjoy
Constructor | ngOninit |
A constructor is not the concept of Angular. It is the concept of JavaScript's class. | ngOninit is the second stage of Angular component lifecycle hook whenever is called when angular is done which creating the component. |
Constructor is best place to add all dependencies | ngOninit function which guarantees you that the component has already been created. |
Constructor is automatically called at the time of creating the object of the class. | Invoked by Angular when component is initialized |
Used for Injecting dependencies | Actual business logic performed |
we should use constructor() to setup Dependency Injection | is a better place to write "actual work code" that we need to execute as soon as the class is instantiated. |
@Components | @Directives |
For register component we use @Component meta-data annotation. | For register directives we use @Directive meta-data annotation. |
Component is a directive which use shadow DOM to create encapsulate visual behavior called components. Components are typically used to create Ul widgets. | Directives are used to add behavior to an existing DOM element. |
Component is used to break up the application into smaller components. | Directive is used to design reusable components. |
Only one component can be present per DOM element. | Many directive can be used in a per DOM element |
Component is used to define pipes | You can't define Pipes in a directive. |
@View decorator or templateurl template are mandatory in the component. | Directives don't have a View. |
In this tutorial, you will learn how to set up a Node.js and Express project with Typescript and live auto-reloading. Note that this metho...