Skip to content

Instantly share code, notes, and snippets.

import { Component, OnInit } from '@angular/core';
import { DatePipe } from '@angular/common';
import { FormBuilder, FormGroup } from '@angular/forms';
import {Todo} from './to-do';
import { TodoService } from './to-do.service';
export enum SaveMode {
None,
New,
<div class="container">
<div class="col-md-12">
<h1>My To-Dos</h1>
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th class="text-center">To-Do</th>
<th class="text-center">Due</th>
<th class="text-center">Notes</th>
<th class="text-center">Done</th>
import { Injectable } from '@angular/core';
import { Todo } from './to-do';
import { TODO_ITEMS } from '../../api/to-do-data';
@Injectable()
export class TodoService {
pItems: Todo[] = TODO_ITEMS;
constructor() { }
export interface Todo {
id: number;
name: string;
notes: string;
due: Date;
done: Boolean;
}
import {Todo} from '../app/to-do/to-do';
export const TODO_ITEMS: Todo[] = [
{
id: 1,
name: 'Lunch with Lily',
notes: 'sea food',
due: new Date(new Date().setDate(new Date().getDate() + 4)),
done: false
}, {
//zones can be entirely bypassed by bootstrapping the app with 'noop'
platformBrowserDynamic()
.bootstrapModule(AppModule, {ngZone: 'noop'})
.then( ref => {} );
@orlando-c-h
orlando-c-h / app.component.html
Last active April 5, 2018 08:51
app.component.html
<app-to-do></app-to-do>
@orlando-c-h
orlando-c-h / angular-dockerfile
Last active June 19, 2018 21:02
Dockerfile to build Node.js based image
#==================== Building Stage ================================================
# Create the image based on the official Node 8.9.0 image from Dockerhub
FROM node:8.9.0 as node
# Create a directory where our app will be placed. This might not be necessary
RUN mkdir -p /to-do-app
# Change directory so that our commands run inside this new directory
WORKDIR /to-do-app
@orlando-c-h
orlando-c-h / .dockerignore
Last active December 5, 2017 15:09
This file will potentially avoid adding unecessary files to a Docker image
#excluding the node_modules directory and the .git directory
node_modules/
.git/
@orlando-c-h
orlando-c-h / nginx-to-do-app.conf
Created December 4, 2017 19:20
Nginx custom configuration file
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html =404;
}
}