ngSemantic icon indicating copy to clipboard operation
ngSemantic copied to clipboard

Template parse errors: 'card-title' is not a known element:

Open ggaborx opened this issue 7 years ago • 17 comments

I just copied a html content from the example: https://ng-semantic.herokuapp.com/#/elements/card

The works well - shows an empty card - but all inner elements missing: , , ...

I don't know what should I do.

ggaborx avatar Sep 08 '16 07:09 ggaborx

I figured out this is an Angular RC6 issue: https://github.com/angular/angular/issues/11251

Regarding the comments the most suitable / future proof way would be use class names or custom attributes for all ng-content. The CUSTOM_ELEMENTS_SCHEMA is just a workaround.

So I suggest to change all ng-content selectors:

a. classname: <ng-content select=".card-title"> | html: <div class="card-title">
b. atribute: <ng-content select="[card-title]"> | html: <div card-title>

Personally I prefer the b. way because it requires less html and that wouldn't break the concept of class should be used for styling.

ggaborx avatar Sep 08 '16 08:09 ggaborx

It is indeed a matter of style. @vladotesanovic, which one do you think we should adopt ? Should we use the class selector form, the attribute selector form, or the component selector form ?

nimaen avatar Sep 08 '16 09:09 nimaen

I hope the decision will be taken soon, because this makes unusable a lot of components!

giacomocerquone avatar Sep 26 '16 19:09 giacomocerquone

Well, I haven't seen @vladotesanovic for days. Let's wait the end of the week, I'll merge a bunch of PR if he's not here. In the meanwhile, could you give us your suggestion regarding this matter with some explanation ? :) As for myself, I'd rather have custom elements, since semantically, attributes refers to a html node property and classes refers to style.

nimaen avatar Sep 26 '16 20:09 nimaen

I prefer actually the b. option (the attribute) wrote by @ggaborx for almost the same reasons! I don't care about writing "less or more html" but it's very important here to not break the concept of classes. It would be very unpleasant to be forced to attach a class to an element for a completely different reason than styling that element (we did that a lot actually in the past few years with libraries like jQuery etc. but this is also the reason why new possibilities like attributes came out).

Hoping that I expressed myself in a decent way.

giacomocerquone avatar Sep 26 '16 20:09 giacomocerquone

Fair enough :) That was a good point. There is no best way to do it anyway : we just have to pick one which looks logical and correct. Yours is. Let's wait a bit then ;)

nimaen avatar Sep 26 '16 20:09 nimaen

Any progress on this? Just found this project and it looks great in theory - I want to use cards though (I assume more components don't work too)!

lewisacidic avatar Oct 05 '16 18:10 lewisacidic

@vladotesanovic is back. He should merge a lot of stuff this week :)

nimaen avatar Oct 05 '16 18:10 nimaen

Any update on this? I have the same problem with sm-modal component

lucacavallaro avatar Oct 22 '16 15:10 lucacavallaro

I am also running into this issue with sm-accordion.

Digadadave avatar Oct 27 '16 17:10 Digadadave

Hello. I am runnin in this issue too.

In my opinion. a framework which main objective is to create HTML components must allow the option of transclusion with element names.

It's much more elegant, readable and less verbose this:

<my-component> <my-component-title>title</my-component-title> <my-component-content>content</my-component-content> </my-component>

instead of using CSS selectors. It seems to the common sense that the right way of doing things is the first option.

YagoLopez avatar Oct 28 '16 00:10 YagoLopez

Any word on this? @vicb seemed pretty adamant that the error message was worth more than this use case. It is a really useful error message for a common problem. That being said, I am frustrated that he shutdown the discussion on https://github.com/angular/angular/issues/11251, as his multiple ways to solve this all feel really hacky. @YagoLopez 's approach is really intuitive, and I would love to see this implemented (Especially since this was the way it was originally done and we lost it due a breaking change in a release candidate :/).

jcjolley avatar Dec 13 '16 18:12 jcjolley

Any news on this issue ?

RafPe avatar Mar 21 '17 21:03 RafPe

I get the exact same errors with accordion-title. Any Updates? @vladotesanovic

mamsoudi avatar Apr 04 '17 16:04 mamsoudi

Instead of using accordion-title, i fall back to use <div class="title">. And it is working for me, including nested accordions.

<sm-accordion class="styled">
  <ng-template let-user ngFor [ngForOf]="users">
    <div class="title">
      <i class="dropdown icon"></i>
      {{user.name}}
    </div>
    <div class="content">
      <p>{{user.description}}</p>
    </div>
  </ng-template>
</sm-accordion>

agongdai avatar Apr 24 '17 13:04 agongdai

im hitting this issue with mat-card-title also..

REPTILEHAUS avatar Nov 03 '17 11:11 REPTILEHAUS

I came across this issue too when I was trying to use the card-title. Has this problem been fixed?

aligator4sah avatar Mar 30 '18 18:03 aligator4sah