Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't offline compile components with reference to material components #832

Closed
thelgevold opened this issue Jul 8, 2016 · 4 comments
Closed

Comments

@thelgevold
Copy link

Bug:

From what I can tell, it's not possible to offline compile my components if there are references to MD components.

I have the following CLI generated component:

import { Component } from '@angular/core';
import { MdButton } from '@angular2-material/button'; 

@Component({
  moduleId: module.id,
  selector: 'app-root',
  templateUrl: 'app.component.html',
  styleUrls: ['app.component.css'],
  directives: [MdButton] // This throws an error when offline compiling
})
export class AppComponent {
  title = 'app works!';
}

In my sample component I am importing and registering MdButton, but when running ./node_modules/.bin/ngc -p ./src I get the error:

Error: No Directive annotation found on MdButton
    at new BaseException (/Users/tor/temp-repo/material/node_modules/@angular/compiler/src/facade/exceptions.js:27:23)
    at DirectiveResolver.resolve (/Users/tor/temp-repo/material/node_modules/@angular/compiler/src/directive_resolver.js:34:15)
    at CompileMetadataResolver.getDirectiveMetadata (/Users/tor/temp-repo/material/node_modules/@angular/compiler/src/metadata_resolver.js:108:51)
    at /Users/tor/temp-repo/material/node_modules/@angular/compiler/src/metadata_resolver.js:230:62
    at Array.map (native)
    at CompileMetadataResolver.getViewDirectivesMetadata (/Users/tor/temp-repo/material/node_modules/@angular/compiler/src/metadata_resolver.js:230:27)
    at normalize (/Users/tor/temp-repo/material/node_modules/@angular/compiler-cli/src/codegen.js:37:45)
    at Array.map (native)
    at CodeGenerator.generateSource (/Users/tor/temp-repo/material/node_modules/@angular/compiler-cli/src/codegen.js:44:38)
    at /Users/tor/temp-repo/material/node_modules/@angular/compiler-cli/src/codegen.js:99:30

What is the expected behavior?

I would expect offline compilation to work with Md components

What is the current behavior?

What are the steps to reproduce?

Offline compile a component with a reference to an MD component.

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, Material, OS, browsers are affected?

OSX, all browsers

Is there anything else we should know?

@jelbourn
Copy link
Member

jelbourn commented Jul 8, 2016

See #774

@jelbourn jelbourn closed this as completed Jul 8, 2016
@jelbourn
Copy link
Member

jelbourn commented Jul 8, 2016

We're actively working on this now

@thelgevold
Copy link
Author

Ok, perfect!

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants