const ROUTES = [
{
path: '',
component: HomeComponent
},
...PARENT_ROUTES
]
const PARENT_ROUTES = [
This file contains 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 { Routes } from '@angular/router'; | |
export function getRouteComponents(routes: Routes, routeComponents: any[] = []) { | |
routes.forEach(route => { | |
if (route.component) { | |
routeComponents.push(route.component); | |
} | |
if (route.children) { | |
getRouteComponents(route.children, routeComponents); |
This file contains 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 {Injectable, NgModuleFactory, NgModuleFactoryLoader, Compiler, Type} from '@angular/core'; | |
class LoaderCallback { | |
constructor(public callback) {} | |
} | |
export let load: Type = (callback: Function) => { | |
return new LoaderCallback(callback); | |
}; |
This file contains 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() { | |
var user = angular.module('user', []); | |
user.component('user', { | |
template: 'User <br><br><ng-outlet></ng-outlet>', | |
$routeConfig: [ | |
{ path: '/profile', name: 'Profile', component: 'userProfile' } | |
] | |
}); | |
This file contains 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() { | |
var app = angular.module('myApp', ['oc.lazyLoad', 'ngComponentRouter']); | |
app.component('app', { | |
template: [ | |
'<a ng-link="[\'Home\']">Home</a> |', | |
'<a ng-link="[\'About\']">About</a> |', | |
'<a ng-link="[\'User\', \'Profile\']">User Profile</a>', | |
'<hr>', | |
'<ng-outlet></ng-outlet>' |
This file contains 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() { | |
var app = angular.module('myApp', ['ngComponentRouter']); | |
app.component('app', { | |
template: [ | |
'<a ng-link="[\'Home\']">Home</a> |', | |
'<a ng-link="[\'About\']">About</a> |', | |
'<a ng-link="[\'User\', \'Profile\']">User Profile</a>', | |
'<hr>', | |
'<ng-outlet></ng-outlet>' |
This file contains 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 {Injectable} from 'angular2/core'; | |
import {Http} from 'angular2/http'; | |
import {Observable} from 'rxjs/Observable'; | |
import 'rxjs/add/operator/map'; | |
const GITHUB_API_URL = 'https://api.github.com'; | |
export class Repository { | |
name: string; | |
full_name: string; |
NewerOlder