This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
Component, | |
Input, | |
Output | |
} from '@angular/core'; | |
@Component({ | |
selector: 'my-component', | |
template: ` | |
<span>Input: {{ option }}</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
Component | |
} from '@angular/core'; | |
@Component({ | |
selector: 'my-component', | |
template: `<ng-content></ng-content>` | |
}) | |
export class MyComponent { | |
ngOnInit() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
Component | |
} from '@angular/core'; | |
class MyProvider { | |
doSomething() { | |
// it's doing something | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
Component, | |
ViewChild, | |
ContentChild | |
} from '@angular/core'; | |
@Component({ | |
selector: 'view-child', | |
template: `<ng-content></ng-content>` | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
Component, | |
forwardRef, | |
Inject | |
} from 'angular2/core'; | |
@Component({ | |
selector: 'child', | |
template: ` | |
<ng-content></ng-content> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
Component, | |
Http | |
} from 'angular2/core'; | |
@Component({ | |
selector: 'app', | |
template: ` | |
<ng-content></ng-content> | |
`, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
Component, | |
Renderer | |
} from '@angular/core'; | |
@Component({ | |
selector: 'my-component', | |
template: ` | |
<input #input type="text" /> | |
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
Component | |
} from '@angular/core'; | |
@Component({ | |
selector: 'child-one', | |
template: ` | |
<ng-content></ng-content> | |
` | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const CREATE_TODO = 'CREATE_TODO'; | |
const MARK_DONE = 'MARK_DONE'; | |
export class CreateTodoAction { | |
public type = CREATE_TODO; | |
constructor(public payload: Todo) {} | |
} | |
export class MarkTodoDoneAction { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createReducer, Action } from 'typed-reducer'; | |
import { CreateTodoAction, MarkTodoDoneAction } from './todo.actions'; | |
class TodoReducer { | |
@Action | |
public createTodo(state: Todo[], action: CreateTodoAction): Todo[] { | |
return [ ...state, action.payload ]; | |
} | |
@Action |
OlderNewer