×
  • Best Way To Build And Publish Angular Library (v10)

  • 04 – Use Configurable Angular Library Module

    Lesson List

    In this lesson will see how can we use the Configurable Angular Library Module in any angular application which we have made.

    Importing Angular Library

    As we import other modules similarly we will import our library into our app.module.ts

    src/app/app.module.ts
    
    ...
    import { NewsTwentyfourModule } from 'projects/news-twentyfour/src/public-api';
    @NgModule({
      declarations: [ AppComponent ],
      imports: [
        BrowserModule,
        NewsTwentyfourModule.forRoot({Token: 'xxxx-xxxx-xxxxxxxx-xxxxxxxxxxxxxx'})
      ],
      bootstrap: [AppComponent]
    })
    export class AppModule { }
    

    And then directly in our app.component.html, we can add the library component so it will view the news details from the library to our angular application.

    src/app/app.component.ts
    
    <h1>News List</h1>
    <lib-news-twentyfour></lib-news-twentyfour>
    

    View

    Configurable Angular Library : News API View

    Configurable Angular Library
    .
    .
  • Enable Notifications    Ok No thanks
    We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.
    Accept