fix: throw for synthetic properties / listeners by default (#14880)

This allows to detect the case that the animation module is not loaded.
This commit is contained in:
Tobias Bosch
2017-03-06 17:15:08 -08:00
committed by Chuck Jazdzewski
parent ba4b6f58d9
commit 3651d8d673
7 changed files with 85 additions and 9 deletions

View File

@ -6,10 +6,10 @@
* found in the LICENSE file at https://angular.io/license
*/
import {ApplicationRef, NgModule} from '@angular/core';
import {ApplicationRef, NgModule, NgZone, Provider, RendererFactoryV2} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
import {ServerModule} from '@angular/platform-server';
import {NoopAnimationsModule, ɵAnimationEngine, ɵAnimationRendererFactory} from '@angular/platform-browser/animations';
import {ServerModule, ɵServerRendererFactoryV2} from '@angular/platform-server';
import {MdButtonModule} from '@angular2-material/button';
// Note: don't refer to third_party_src as we want to test that
// we can compile components from node_modules!
@ -25,6 +25,19 @@ import {CompUsingRootModuleDirectiveAndPipe, SomeDirectiveInRootModule, SomeLibM
import {CompWithNgContent, ProjectingComp} from './projection';
import {CompForChildQuery, CompWithChildQuery, CompWithDirectiveChild, DirectiveForQuery} from './queries';
export function instantiateServerRendererFactory(
renderer: RendererFactoryV2, engine: ɵAnimationEngine, zone: NgZone) {
return new ɵAnimationRendererFactory(renderer, engine, zone);
}
// TODO(matsko): create a server module for animations and use
// that instead of these manual providers here.
export const SERVER_ANIMATIONS_PROVIDERS: Provider[] = [{
provide: RendererFactoryV2,
useFactory: instantiateServerRendererFactory,
deps: [ɵServerRendererFactoryV2, ɵAnimationEngine, NgZone]
}];
@NgModule({
declarations: [
AnimateCmp,
@ -58,7 +71,10 @@ import {CompForChildQuery, CompWithChildQuery, CompWithDirectiveChild, Directive
SomeLibModule.withProviders(),
ThirdpartyModule,
],
providers: [SomeService],
providers: [
SomeService,
SERVER_ANIMATIONS_PROVIDERS,
],
entryComponents: [
AnimateCmp,
BasicComp,