0

I am trying to create an app to document internal reusable components for my company but am having trouble figuring out how to display Angular Typescript code from within my Angular documentation app.

Whenever I try to do this, I see the following error:

Error in @angular/[email protected]/bundles/compiler.umd.js (2603:21)
Template parse errors:
Invalid ICU message. Missing '}'. ("
export class SliderComponent {}

[ERROR ->]</code>"): ng:///AppModule/AppComponent.html@9:0

And the only code I really have in the project is in the app.component.html file and it looks like this:


<code>
  @Component({
        selector: 'app-slider-alt',
        templateUrl: './slider-alt.template.html',
        styleUrls: ['./slider.component.scss']
      })
      export class SliderComponent {}

</code>

Stackblitz link

Any ideas?

1 Answer 1

1

The problem is the curly braces. You can replace them with:

  • { => &#123;

  • } => &#125;

<code>
@Component(&#123;
  selector: 'app-slider-alt',
  templateUrl: './slider-alt.template.html',
  styleUrls: ['./slider.component.scss']
&#125;)
export class SliderComponent &#123;&#125;
</code>

Also, I think it looks nicer with <pre> instead of <code>

Stackblitz demo

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you so much for your response. I think that got me in the right direction, but then angular starts complaining about the "@" sign, so I switched that to the HTML number, and then it started complaining about "Component` to which I switched the "C" to the html number but it wouldn't stop complaining about it.
That's weird... it's working on stackblitz.
Maybe it's cause I am doing quite a bit more locally. But you are right it does work in Stackblitz. Thanks for your help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.