question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

real angular 2 comment on template

See original GitHub issue

I’m submitting a … (check one with “x”)

[ x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior As Thierry Templier said on http://stackoverflow.com/questions/36396765/commenting-out-code-in-angular2-typescript If you are in the template, use the HTML comment :

@Component({
  selector: 'my-app',
  template: `
    <h1>{{title}}</h1>
    <h2>{{lene.name}}</h2>
    <div><label>id: </label>{{lene.id}}</div>
    <!-- div>
      <label>name: </label>
      <input [(ngModel)]="lene.name" placeholder="name">
    </div-->
    <div><label>description: </label>{{lene.description}}</div>
  `
})

. Expected behavior real angular comment out on template

Minimal reproduction of the problem with instructions but this is not real angular comment

<!-- div>
      <label>name: </label>
      <input [(ngModel)]="lene.name" placeholder="name">
    </div-->


What is the motivation / use case for changing the behavior? because if lene is null, we get exception

Please tell us about your environment:

  • Angular version: 2.0.X
  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
  • Language: [all | TypeScript X.X | ES6/7 | ES5]

  • Node (for AoT issues): node --version =

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
glinkotcommented, May 22, 2017

I find Angular just ignores the comment indicators and renders it anyway. Having a way to comment things out would be a big help.

0reactions
angular-automatic-lock-bot[bot]commented, Sep 14, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Commenting (out) code in Angular2 TypeScript - Stack Overflow
@GünterZöchbauer I'm working on a very simple Angular2 project and have an HTML comment in my template and the comment is not being...
Read more >
Template syntax - Angular
In Angular, a template is a chunk of HTML. Use special syntax within a template to build on many of Angular's features.
Read more >
Creating HTML Comments in Angular | Damir's Corner
Although comments in HTML markup usually don't play an important role ... Angular removes all comments from the template during processing.
Read more >
Create a commenting Application with Angular 2 - Dunebook
In This Tutorial , we're going to create a commenting Application using angular 2. That will enable users to write comments in various...
Read more >
Have you ever bought an Angular template? : r/Angular2
No (use only free templates or from scratch) ... Add a Comment ... Writing a GameBoy game in TypeScript that runs on real...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found