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

angular4 webpack2 build error #4172

Closed
TaylorPzreal opened this issue Apr 20, 2017 · 5 comments
Closed

angular4 webpack2 build error #4172

TaylorPzreal opened this issue Apr 20, 2017 · 5 comments

Comments

@TaylorPzreal
Copy link

feature request:

polyfills.0836852….js:2 Unhandled Promise rejection: Template parse errors:
Can't bind to 'mdmenutriggerfor' since it isn't a known property of 'a'. ("Home Blog About <a class=pull-right md-button [ERROR ->][mdmenutriggerfor]=theme>Theme <md-menu #theme=mdMenu> <md-icon class=text-"): ng:///AppModule/AppComponent.html@0:152
Can't bind to 'mdmenutriggerfor' since it isn't a known property of 'button'. ("dashboard Blue Ocean <button class=pull-right md-button [ERROR ->][mdmenutriggerfor]=account>TaylorPzreal <md-menu #account=mdMenu> <md-"): ng:///AppModule/AppComponent.html@0:567 ; Zone: ; Task: Promise.then ; Value: Error: Template parse errors:
Can't bind to 'mdmenutriggerfor' since it isn't a known property of 'a'. ("Home Blog About <a class=pull-right md-button [ERROR ->][mdmenutriggerfor]=theme>Theme <md-menu #theme=mdMenu> <md-icon class=text-"): ng:///AppModule/AppComponent.html@0:152
Can't bind to 'mdmenutriggerfor' since it isn't a known property of 'button'. ("dashboard Blue Ocean <button class=pull-right md-button [ERROR ->][mdmenutriggerfor]=account>TaylorPzreal <md-menu #account=mdMenu> <md-"): ng:///AppModule/AppComponent.html@0:567
at syntaxError (http://localhost:9000/dist/vendor.08368524123563a175f8.js:2:293382) []
at TemplateParser.parse (http://localhost:9000/dist/vendor.08368524123563a175f8.js:2:484994) []

when i use webpack in my dev it's success, but when i build it get those errors.

my development:
Linux + Chrome
Angular4.0.2 + @angular/material2.0.0-beta.3 + webpack2.3.3

@devversion
Copy link
Member

devversion commented Apr 20, 2017

At first glance it looks like something minifies your HTML in a non-case-sensitive way. This causes the directive to be not valid anymore.

Are you using the HTML-Loader? If so, with some special configuration?

Could also be the other way around and you specified it lower-case yourself. The directive is [mdMenuTriggerFor]=""

@TaylorPzreal
Copy link
Author

@devversion thank you very much, i used html-loader, when i changed to 'raw-loader', get success.

@TaylorPzreal
Copy link
Author

TaylorPzreal commented Apr 20, 2017

  1. change 'html-loader' with 'raw-loader' can fix the bug;
    new webpack.LoaderOptionsPlugin({
      htmlLoader: {
        minimize: DEVELOPMENT // workaround for ng2
      },
     // minimize: PRODUCTION, // Comment out this line
      debug: DEVELOPMENT,
      options: {
        context: __dirname
      }
    })

it's workd for production.
but now the same error when i run karma testing...

@TaylorPzreal
Copy link
Author

@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