|
6 | 6 | * found in the LICENSE file at https://angular.io/license
|
7 | 7 | */
|
8 | 8 |
|
9 |
| -import {Injector, Class, Component, OnChanges, OnDestroy, SimpleChanges, EventEmitter, |
10 |
| - NO_ERRORS_SCHEMA, NgModule, NgModuleRef, OpaqueToken, Testability, destroyPlatform, |
11 |
| - forwardRef} from '@angular/core'; |
12 |
| -import {async, fakeAsync, tick} from '@angular/core/testing'; |
13 |
| -import {BrowserModule, platformBrowser, } from '@angular/platform-browser'; |
14 |
| -import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; |
15 |
| -import {UpgradeModule, ng2ProviderFactory, ng1ServiceProvider, downgradeNg2Component} from '@angular/upgrade'; |
16 |
| -import {parseFields} from '@angular/upgrade/src/metadata'; |
| 9 | +import { |
| 10 | + Injector, Class, Component, OnChanges, OnDestroy, SimpleChanges, EventEmitter, NO_ERRORS_SCHEMA, |
| 11 | + NgModule, NgModuleRef, OpaqueToken, Testability, destroyPlatform, forwardRef |
| 12 | +} from '@angular/core'; |
| 13 | +import { async, fakeAsync, tick } from '@angular/core/testing'; |
| 14 | +import { BrowserModule, platformBrowser } from '@angular/platform-browser'; |
| 15 | +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; |
| 16 | +import { |
| 17 | + UpgradeModule, ng2ProviderFactory, ng1ServiceProvider, downgradeNg2Component |
| 18 | +} from '@angular/upgrade'; |
| 19 | +import { parseFields } from '@angular/upgrade/src/metadata'; |
17 | 20 | import * as angular from '@angular/upgrade/src/angular_js';
|
18 | 21 |
|
19 | 22 | export function main() {
|
@@ -44,7 +47,7 @@ export function main() {
|
44 | 47 |
|
45 | 48 | // the ng1 app module that will consume the downgraded component
|
46 | 49 | const ng1Module = angular.module('ng1', [])
|
47 |
| - // create an ng1 facade of the ng1 component |
| 50 | + // create an ng1 facade of the ng2 component |
48 | 51 | .directive('ng2', downgradeNg2Component({ selector: 'ng2', type: Ng2Component }));
|
49 | 52 |
|
50 | 53 | const element =
|
@@ -139,6 +142,7 @@ export function main() {
|
139 | 142 | $rootScope['eventA'] = '?';
|
140 | 143 | $rootScope['eventB'] = '?';
|
141 | 144 | });
|
| 145 | + |
142 | 146 | @Component({
|
143 | 147 | selector: 'ng2',
|
144 | 148 | inputs: [
|
@@ -299,7 +303,6 @@ export function main() {
|
299 | 303 | });
|
300 | 304 | }));
|
301 | 305 |
|
302 |
| - |
303 | 306 | it('should fallback to the root ng2.injector when compiled outside the dom', async(() => {
|
304 | 307 |
|
305 | 308 | @Component({selector: 'ng2', template: 'test'})
|
@@ -994,7 +997,7 @@ export function main() {
|
994 | 997 | // create the ng1 module that will import an ng2 service
|
995 | 998 | const ng1Module = angular.module('ng1Module', [])
|
996 | 999 | .factory('ng2Service', ng2ProviderFactory(Ng2Service))
|
997 |
| - .factory('ng1Service', () => 'ng1 service value'); |
| 1000 | + .value('ng1Service', 'ng1 service value'); |
998 | 1001 |
|
999 | 1002 | it('should export ng2 instance to ng1', async(() => {
|
1000 | 1003 | platformBrowserDynamic().bootstrapModule(MyNg2Module).then((ref) => {
|
|
0 commit comments