-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
58 additions
and
45 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,18 @@ | ||
// This module is purely written in Angular 1. | ||
import * as angular from 'angular'; | ||
import {NgModule} from '@angular/core'; | ||
import {UpgradeAdapter} from '@angular/upgrade'; | ||
|
||
import {MenuCmp} from './menu_cmp'; | ||
|
||
export const MenuModule = angular.module('MenuModule', ['ngRoute']); | ||
|
||
MenuModule.component('menu', MenuCmp); | ||
|
||
MenuModule.config(($routeProvider) => { | ||
$routeProvider.when('/', {template : '<menu></menu>'}); | ||
}); | ||
|
||
// techncially, this is not required, but it is nice to have it for consistency | ||
@NgModule({}) | ||
export class MenuNgModule { | ||
static setAdapter(adapter: UpgradeAdapter) { | ||
//no components are migrated to angular2 | ||
} | ||
static setAdapter(adapter: UpgradeAdapter) {} | ||
} |
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
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
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
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
File renamed without changes.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// angular1 imports | ||
import * as angular from 'angular' | ||
import 'angular-route' | ||
|
||
// angular2 imports | ||
import {NgModule, Component} from '@angular/core'; | ||
import {Router, RouterModule, UrlHandlingStrategy} from '@angular/router'; | ||
import {BrowserModule} from '@angular/platform-browser'; | ||
import {UpgradeAdapter} from '@angular/upgrade'; | ||
|
||
// modules | ||
import {MessagesModule, MessagesNgModule} from './messages'; | ||
import {MenuModule, MenuNgModule} from './menu'; | ||
import {SettingsNgModule} from './settings'; | ||
|
||
|
||
@Component({selector : 'ng2-router-root', template: `<router-outlet></router-outlet>`}) | ||
export class Ng2RouterRoot {} | ||
|
||
export function createRootModule(adapter: UpgradeAdapter, moduleNames: string[]) { | ||
const RootModule = angular.module('rootModule', moduleNames); | ||
|
||
RootModule.component('rootCmp', {template : '<div class="ng-view"></div>'}); | ||
RootModule.directive('ng2RouterRoot', <any>adapter.downgradeNg2Component(Ng2RouterRoot)); | ||
RootModule.config(($routeProvider) => { | ||
$routeProvider | ||
.otherwise({template : '<ng2-router-root></ng2-router-root>', reloadOnSearch: false}); | ||
}); | ||
|
||
return RootModule; | ||
} |