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" | |
| 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
| 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
| 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
| 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
| 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
| 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
| class TodoListController { | |
| addTodo(todo){ | |
| this.todosList.push(todo) | |
| } | |
| toggleCheckTodo(index){ | |
| this.todosList[index].completed = !this.todosList[index].completed | |
| } | |
| deleteTodo(index){ | |
| this.todosList.splice(index, 1) | |
| } |
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
| { | |
| "name": "angularjs-tdd-jest", | |
| "version": "0.1.0", | |
| "scripts": { | |
| "server": "webpack-dev-server", | |
| "start": "npm-run-all -p stubs server", | |
| "stubs": "stubby -w -d stubs/fakeserver.yml -s 5000", | |
| "tdd": "cross-env NODE_PATH=./src jest --watch --verbose", | |
| "test": "cross-env NODE_PATH=./src jest --coverage --verbose" | |
| }, |
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
| - request: | |
| url: ^/api/todos | |
| response: | |
| headers: | |
| content-type: application/json | |
| status: 200 | |
| file: todos_get.json |