feat(UpgradeComponent): add support for require

This commit also adds/improves/fixes some `UpgradeComponent` tests.
This commit is contained in:
Georgios Kalpakas
2016-10-20 13:47:56 +03:00
committed by vikerman
parent 469010ea8e
commit fe1d0e29c5
5 changed files with 995 additions and 276 deletions

View File

@ -7,6 +7,7 @@
*/
import {PlatformRef, Type} from '@angular/core';
import * as angular from '@angular/upgrade/src/angular_js';
import {$ROOT_SCOPE} from '@angular/upgrade/src/aot/constants';
import {UpgradeModule} from '@angular/upgrade/static';
export function bootstrap(
@ -20,6 +21,11 @@ export function bootstrap(
});
}
export function digest(adapter: UpgradeModule) {
const $rootScope = adapter.$injector.get($ROOT_SCOPE) as angular.IRootScopeService;
$rootScope.$digest();
}
export function html(html: string): Element {
// Don't return `body` itself, because using it as a `$rootElement` for ng1
// will attach `$injector` to it and that will affect subsequent tests.