Coder Social home page Coder Social logo

Comments (6)

gaweCodes avatar gaweCodes commented on June 10, 2024 1

You are the best! Did I miss something in the documentation or why couldn't I find anything there? I think it would be nice to mention this finding in the documentation.

from coreui-angular.

xidedix avatar xidedix commented on June 10, 2024

@gaweCodes any details about the error? NullInjectorError: No provider for... (what)?

from coreui-angular.

gaweCodes avatar gaweCodes commented on June 10, 2024

I am not sure if this is really relevant. I have no idea what is missing.

ERROR Error: NullInjectorError: No provider for r!
    at new Q (main.js:23:1976)
    at Jp.get (main.js:23:91590)
    at Rh.get (main.js:23:94541)
    at Rh.get (main.js:23:94541)
    at pb.get (main.js:23:114715)
    at su (main.js:23:74154)
    at el (main.js:23:74648)
    at Object.Dc (main.js:23:100425)
    at f.ɵfac [as factory] (main.js:23:340219)
    at Xi (main.js:23:76344)
   ...

This is my template code:

<c-accordion>
  <c-accordion-item #item0="cAccordionItem" [visible]="false">
    <ng-template cTemplateId="accordionHeaderTemplate">
      <button (click)="item0.toggleItem()" [collapsed]="!item0.visible" cAccordionButton>
        Accordion item #0
      </button>
    </ng-template>
    <ng-template cTemplateId="accordionBodyTemplate">
      <div class="accordion-body">
        <strong>This is the first item's accordion body.</strong> It is hidden by default, until the collapse
        plugin adds the appropriate classes that we use to style each element. These classes control the overall
        appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with
        custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go
        within the <code>.accordion-body</code>, though the transition does limit overflow.
      </div>
    </ng-template>
  </c-accordion-item>
  <c-accordion-item #item1="cAccordionItem" [visible]="false">
    <ng-template cTemplateId="accordionHeaderTemplate">
      <button (click)="item1.toggleItem()" [collapsed]="!item1.visible" cAccordionButton>
        Accordion item #1
      </button>
    </ng-template>
    <ng-template cTemplateId="accordionBodyTemplate">
      <div class="accordion-body">
        <strong>This is the second item's accordion body.</strong> It is hidden by default, until the collapse
        plugin adds the appropriate classes that we use to style each element. These classes control the overall
        appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with
        custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go
        within the <code>.accordion-body</code>, though the transition does limit overflow.
      </div>
    </ng-template>
  </c-accordion-item>
  <c-accordion-item #item2="cAccordionItem" [visible]="false">
    <ng-template cTemplateId="accordionHeaderTemplate">
      <button (click)="item2.toggleItem()" [collapsed]="!item2.visible" cAccordionButton>
        Accordion item #2
      </button>
    </ng-template>
    <ng-template cTemplateId="accordionBodyTemplate">
      <div class="accordion-body">
        <strong>This is the third item's accordion body.</strong> It is hidden by default, until the collapse
        plugin adds the appropriate classes that we use to style each element. These classes control the overall
        appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with
        custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go
        within the <code>.accordion-body</code>, though the transition does limit overflow.
      </div>
    </ng-template>
  </c-accordion-item>
</c-accordion>

This imports are in the module that holds the component:

import {
  AccordionModule,
  ButtonModule,
  DropdownModule,
  GridModule,
  HeaderModule,
  SharedModule,
  SidebarModule,
} from '@coreui/angular';

@xidedix What do you think? Do you need more info?

from coreui-angular.

xidedix avatar xidedix commented on June 10, 2024

@gaweCodes so we have to find out what the heck is r ... 😅

I bet you need to import BrowserAnimationsModule or provideAnimations

on ng modules:

in your app.module.ts

import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
...

@NgModule({
  imports: [
    BrowserAnimationsModule,
...

or

on standalone components

in your main.ts

import { provideAnimations } from '@angular/platform-browser/animations';
...
bootstrapApplication(AppComponent, {
  providers: [
    provideAnimations()
    ...
  ],
}).catch((err) => console.error(err));

see the demo for the latter:
https://stackblitz.com/edit/stackblitz-coreui-accordion-7qsnt3-4237d6?file=src%2Fmain.ts

from coreui-angular.

xidedix avatar xidedix commented on June 10, 2024

Great suggestion @gaweCodes. We'll make sure to add these details to the docs.

from coreui-angular.

xidedix avatar xidedix commented on June 10, 2024

docs updated

from coreui-angular.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.