Tuesday, October 4, 2016

Simple component angular 2

  • Components are simply directives that are always associated with a direct template
  • Component is nothing but a type script class
  • An Angular application is a tree of Angular components

import { Component } from '@angular/core';

  selector: 'my-story',
  template: `
    <h3 [innerText]="story.name"></h3>
    <div [style.color]="color">{{story.name}}</div>
    {{story| json}}
export class StoryComponent {
  story = { id: 100, name: 'The Force Awakens' };
  color = 'blue';


Note: We can also specify the template URL
selector :'my-story',

No comments:

Post a Comment