Angular 2 Interview question and answer What is the difference between @Component and @Directive in Angular? Components To register a component we use @Component meta-data annotation. Component is a directive which uses shadow DOM to create encapsulated visual behavior called components. Components are typically used to create UI widgets. Component is used to break up the application into smaller components. Only one component can be present per DOM element. @View decorator or templateurl template are mandatory in the component. Directive To register directives we use @Directive meta-data annotation. Directive is used to add behavior to an existing DOM element. Directive is use to design re-usable components. Many directives can be used per DOM element. Directive doesn't use View. Sources: http://www.codeandyou.com/2016/01/difference-between-component-and-directive-in-Angular2.html
Posts
Showing posts from June, 2017
- Get link
- X
- Other Apps
iPhone 5 CSS media query Another useful media feature is device-aspect-ratio . Note that the iPhone 5 does not have a 16:9 aspect ratio . It is in fact 40:71. iPhone < 5: @media screen and (device-aspect-ratio: 2/3) {} iPhone 5: @media screen and (device-aspect-ratio: 40/71) {} iPhone 6: @media screen and (device-aspect-ratio: 375/667) {} iPhone 6 Plus: @media screen and (device-aspect-ratio: 16/9) {} iPad: @media screen and (device-aspect-ratio: 3/4) {}