This file contains hidden or 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 '@uirouter/angularjs' | |
| export function routes($stateProvider, $locationProvider) { | |
| $locationProvider.html5Mode({ | |
| enabled: true, | |
| requireBase: false | |
| }) | |
| $stateProvider | |
| .state("home", { | |
| url: "/", |
This file contains hidden or 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 angular from "angular" | |
| import { routes } from "./routes" | |
| import { TodoListComponent } from "./components/todoList.component" | |
| import { TodoService } from "./services/todo.service" | |
| angular | |
| .module("App", [ | |
| "ui.router" | |
| ]) | |
| .config(routes) |
This file contains hidden or 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
| export class TodoService { | |
| constructor($http, BASE_URL) { | |
| this.http = $http; | |
| this.url = `${BASE_URL}/todos` | |
| } | |
| getTodos() { | |
| return this.http.get(this.url) | |
| .then(res => res.data.todos) | |
| .catch(error => error.message) | |
| } |
This file contains hidden or 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
| class TodoListController { | |
| constructor(){ | |
| this.todosList = [ | |
| { | |
| name: "Learn Programming using component based approach", | |
| completed: true | |
| }, | |
| { | |
| name: "Learn Machine Learning", | |
| completed: false |
This file contains hidden or 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
| module.exports = { | |
| entry: [ | |
| "./src/index.js" | |
| ], | |
| output: { | |
| path: __dirname + "/dist", | |
| filename: "index.bundle.js" | |
| }, | |
| module: { | |
| rules: [ |
This file contains hidden or 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 angular from 'angular'; | |
| import { routes } from './routes' | |
| import { TodoListComponent } from "./components/todoList.component" | |
| angular | |
| .module('App', ['ngRoute']) | |
| .config(routes) | |
| .component('todoList', TodoListComponent) | |
This file contains hidden or 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 '@uirouter/angularjs' | |
| export function routes($stateProvider, $locationProvider) { | |
| $locationProvider.html5Mode({ | |
| enabled: true, | |
| requireBase: false | |
| }) | |
| $stateProvider | |
| .state("home", { | |
| url: "/", |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Boolean's Professional Web Development Series</title> | |
| </head> | |
| <body class="container" ng-strict-di> | |
| <header class="app-header"> | |
| <h1> | |
| Todo List | |
| </h1> |
This file contains hidden or 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
| <div class="todo-list"> | |
| <div ng-repeat="todo in $ctrl.todosList track by $index"> | |
| <label> | |
| <input type="checkbox" ng-model="todo.completed"> {{todo.name}} | |
| <button ng-click="$ctrl.deleteTodo($index)">x</button> | |
| </label> | |
| </div> | |
| </div> |
This file contains hidden or 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
| export class TodoListController { | |
| constructor(){ | |
| this.todosList = [] | |
| } | |
| addTodo(todo){ | |
| this.todosList.push(todo) | |
| } | |
| toggleCheckTodo(index){ | |
| this.todosList[index].completed = !this.todosList[index].completed | |
| } |