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 function initApp(http: HttpClient) { | |
| return () => { | |
| return http.get('https://api.github.com/users/sagar-ganatra') | |
| .toPromise() | |
| .then((resp) => { | |
| console.log('Response 1 - ', resp); | |
| }); | |
| }; | |
| } |
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 function initApp() { | |
| return () => { | |
| return new Promise((resolve) => { | |
| setTimeout(() => { | |
| console.log('In initApp'); | |
| resolve(); | |
| }, 3000); | |
| }); | |
| }; | |
| } |
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 { BrowserModule } from '@angular/platform-browser'; | |
| import { NgModule, APP_INITIALIZER } from '@angular/core'; | |
| import { AppComponent } from './app.component'; | |
| @NgModule({ | |
| declarations: [ | |
| AppComponent | |
| ], | |
| imports: [ | |
| BrowserModule |
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 React, { Component } from "react"; | |
| import { observer } from "mobx-react"; | |
| import Book from "../Book/"; | |
| import "./ShoppingCart.css"; | |
| @observer | |
| class ShoppingCart extends Component { | |
| render() { | |
| return ( | |
| <div className="shopping-cart-component"> |
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
| // create a flight component | |
| var AboutMeBtn = flight.component(aboutMe); | |
| // component definition | |
| function aboutMe () { | |
| // event listener for the click event | |
| this.onAboutMeBtnClick = function () { | |
| alert('About me'); | |
| }; |
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>{{ .Site.Title }}</title> | |
| </head> | |
| <body> | |
| <nav> | |
| {{ range .Site.Pages }} | |
| {{ if eq .Type "pages" }} | |
| <a href="{{ .Permalink }}">{{ .Title }}</a> |
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
| exports.fn1 = function(){ | |
| 'use strict'; | |
| console.log('Example 1 - use of let in blocks'); | |
| let a = 10; | |
| function test() { //new scope, TDZ | |
| //console.log(a); //throws reference error |
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
| window.app.config([ | |
| '$routeProvider', | |
| '$controllerProvider', | |
| '$compileProvider', | |
| '$filterProvider', | |
| '$provide', | |
| function ($routeProvider, $controllerProvider, $compileProvider, $filterProvider, $provide) { | |
| //router definition here |
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
| $routeProvider | |
| .when('/login', { | |
| templateUrl: 'components/login/partials/login.html', | |
| resolve: { | |
| load: ['$q', '$rootScope', function ($q, $rootScope) { | |
| var deferred = $q.defer(); | |
| require ([ | |
| 'components/login/controllers/loginController', |
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
| function loadPage (ctx, next) { | |
| //show the home page if at the root path | |
| if(ctx.path === '/' ) { | |
| PageManager.loadPage('home'); | |
| } else { | |
| //load the page based on the selected route |
NewerOlder