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

Fix templateUrl regexp for the single line component decorator #44

Merged
merged 1 commit into from
Jan 16, 2017

Conversation

maksim-tolo
Copy link
Contributor

I have found that if you want to pass parameters to the @component decorator in a single line you will get the following error:

Uncaught ReferenceError: require is not defined

It's caused by incorrect templateUrlRegex which converts

@Component({selector: 'my-app', templateUrl: './app.component.html', styleUrls: ['./app.component.css']})
export class AppComponent { };

to the following code:

@Component({selector: 'my-app', template: require('./app.component.html'), styles: [require(require('./app.component.css'))]})
export class AppComponent { };

@codecov-io
Copy link

codecov-io commented Dec 5, 2016

Current coverage is 96.42% (diff: 100%)

Merging #44 into master will not change coverage

@@             master        #44   diff @@
==========================================
  Files             1          1          
  Lines            28         28          
  Methods           5          5          
  Messages          0          0          
  Branches          5          5          
==========================================
  Hits             27         27          
  Misses            1          1          
  Partials          0          0          

Powered by Codecov. Last update beb5b95...dd64d81

@TheLarkInn TheLarkInn merged commit c58930d into TheLarkInn:master Jan 16, 2017
@TheLarkInn
Copy link
Owner

Thank you very much.

@alex321
Copy link

alex321 commented Feb 2, 2017

I've just encountered this today.
@maksim-tolo Thanks for fixing it. 👍

@TheLarkInn Is it possible to release that soon as we are using automated formatting that inlines the @component declarations.

Thanks!

@TheLarkInn
Copy link
Owner

Published. Thanks https://github.com/TheLarkInn/angular2-template-loader/releases

If anything comes up, let me know and don't hesitate to @ mention me in an issue or PR.

@MarkPieszak
Copy link

@TheLarkInn Looks like this Regex messed up multi-line Component declarations, v0.6.1 has issues popping up from a bunch of users.
Maybe we can revert for now, release a 0.6.2 to fix it for now?

#50
aspnet/JavaScriptServices#645

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants