Skip to content

Instantly share code, notes, and snippets.

View cpanuphan's full-sized avatar

Panuphan Chaimanee cpanuphan

  • BananaCoding
  • Chiangmai Thailand
View GitHub Profile
ng generate service TodoData
h1 {
text-align: center;
}
.example-full-width {
width: 100%;
}
<app-todo-add></app-todo-add>
@cpanuphan
cpanuphan / todo-add.component.ts
Last active September 19, 2018 04:02
Initial file
import { Component } from '@angular/core';
import { TodoItem } from '../todo-item';
@Component({
selector: 'app-todo-add',
templateUrl: './todo-add.component.html',
styleUrls: ['./todo-add.component.css']
})
export class TodoAddComponent {
import {MatInputModule} from '@angular/material';
@NgModule({
...
imports: [MatInputModule],
...
})
export class TodoItem {
id: number;
name: string;
isComplete: boolean;
constructor(values: Object = {}) {
Object.assign(this, values);
}
}
<h1>Todos</h1>
<mat-form-field class="example-full-width">
<input matInput placeholder="What needs to be done?" autofocus=""
[(ngModel)]="newTodo.name" (keyup.enter)="onAddTodo()">
</mat-form-field>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
@import "~@angular/material/prebuilt-themes/indigo-pink.css";
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
@NgModule({
...
imports: [BrowserAnimationsModule],
...
})