diff --git a/packages/compiler-cli/test/compliance/r3_view_compiler_styling_spec.ts b/packages/compiler-cli/test/compliance/r3_view_compiler_styling_spec.ts index d42697b8ae..f7a79c3c02 100644 --- a/packages/compiler-cli/test/compliance/r3_view_compiler_styling_spec.ts +++ b/packages/compiler-cli/test/compliance/r3_view_compiler_styling_spec.ts @@ -133,7 +133,9 @@ describe('compiler compliance: styling', () => { vars: 0, template: function MyComponent_Template(rf, $ctx$) { }, - animations: [{name: 'foo123'}, {name: 'trigger123'}] + data: { + animations: [{name: 'foo123'}, {name: 'trigger123'}] + } }); `; @@ -173,7 +175,9 @@ describe('compiler compliance: styling', () => { vars: 0, template: function MyComponent_Template(rf, $ctx$) { }, - animations: [] + data: { + animations: [] + } }); `; diff --git a/packages/compiler/src/render3/view/compiler.ts b/packages/compiler/src/render3/view/compiler.ts index a4cc3f4761..6595a7c70e 100644 --- a/packages/compiler/src/render3/view/compiler.ts +++ b/packages/compiler/src/render3/view/compiler.ts @@ -245,7 +245,8 @@ export function compileComponentFromMetadata( // e.g. `animations: [trigger('123', [])]` if (meta.animations !== null) { - definitionMap.set('animations', meta.animations); + definitionMap.set( + 'data', o.literalMap([{key: 'animations', value: meta.animations, quoted: false}])); } // On the type side, remove newlines from the selector as it will need to fit into a TypeScript diff --git a/packages/core/src/render3/definition.ts b/packages/core/src/render3/definition.ts index 7513155d19..8615645e0c 100644 --- a/packages/core/src/render3/definition.ts +++ b/packages/core/src/render3/definition.ts @@ -263,11 +263,6 @@ export function defineComponent(componentDefinition: { * `PipeDefs`s. The function is necessary to be able to support forward declarations. */ pipes?: PipeTypesOrFactory | null; - - /** - * Registry of the animation triggers present on the component that will be used by the view. - */ - animations?: any[] | null; }): never { const type = componentDefinition.type; const pipeTypes = componentDefinition.pipes !; @@ -275,11 +270,7 @@ export function defineComponent(componentDefinition: { const declaredInputs: {[key: string]: string} = {} as any; const encapsulation = componentDefinition.encapsulation || ViewEncapsulation.Emulated; const styles: string[] = componentDefinition.styles || EMPTY_ARRAY; - const animations: any[]|null = componentDefinition.animations || null; - let data = componentDefinition.data || {}; - if (animations) { - data.animations = animations; - } + const data = componentDefinition.data || {}; const def: ComponentDef = { type: type, diPublic: null, diff --git a/packages/core/test/render3/integration_spec.ts b/packages/core/test/render3/integration_spec.ts index 12ceb15b41..1f17564e53 100644 --- a/packages/core/test/render3/integration_spec.ts +++ b/packages/core/test/render3/integration_spec.ts @@ -1605,10 +1605,12 @@ describe('render3 integration test', () => { type: AnimComp, consts: 0, vars: 0, - animations: [ - animA, - animB, - ], + data: { + animations: [ + animA, + animB, + ], + }, selectors: [['foo']], factory: () => new AnimComp(), template: (rf: RenderFlags, ctx: AnimComp) => {} @@ -1630,7 +1632,9 @@ describe('render3 integration test', () => { type: AnimComp, consts: 0, vars: 0, - animations: [], + data: { + animations: [], + }, selectors: [['foo']], factory: () => new AnimComp(), template: (rf: RenderFlags, ctx: AnimComp) => {}