Angular Workspace/Monorepo, forRoot giving me errors. "A value for 'forRoot' cannot be determined statically, as it is an external declaration."

Issue I’m having a library called Themex. //envInjector.ts import {InjectionToken} from "@angular/core"; export const ENVIRONMENT = new InjectionToken<{[key: string]: any}>(‘ENVIRONMENT’); //themex.module.ts import {ENVIRONMENT} from "./envInjector"; @NgModule({ declarations: [ ThemexComponent, ModalComponent, UploadComponent, AlertComponent, ], imports: [ CommonModule ], exports: [ ThemexComponent,

Continue reading

Angular 4 Library @Input

Issue Hi guys I need a bit of help, as I can’t seem to get it to work. I think I might be using the incorrect syntax or something. I am currently building Angular 4 libraries using YO https://github.com/jvandemo/generator-angular2-library So

Continue reading

Import third-party libraries to Angular Library gives error

Issue Trying to create library using ng-packagr. Inside project I run : ng g library nt-select –prefix nt inside nt-select.component.ts import { Component, OnInit } from ‘@angular/core’; @Component({ selector: ‘nt-nt-select’, template: ` <mat-form-field> <mat-select [placeholder]=”placeholder” [disabled]=”disabled” [multiple]=”multiple” [(ngModel)]=”value” [required]=”required”> <ngx-mat-select-search

Continue reading

Angular Module vs. Library

Issue So great, the Angular has released version 6 and the CLI provides an option to generate libraries – something that they call a “highly anticipated feature”. Now, coming from a business perspective, I am wondering: why you would actually

Continue reading

Angular six set initial value for @Output EventEmitter

Issue I have a component <p style=”padding: 5px”> <select [(ngModel)]=’thisDD’ name=”nameDD” id=”idDD” (ngModelChange)=”updateDD(thisDD)” class=”form-control”> <option *ngFor=”let thing of thingies” [value]=”thing.thingID”>{{thing.ThingName}} ({{thing.ThingCode}})</option> </select> </p> Which has an @OutPut @Output() selectedValue = new EventEmitter<object>(); And I use this in my app <my-dropdown

Continue reading

Angular 2+ add ng-bootstrap Modal to component library

Issue I’m working with ng-bootstrap and I would like to add a reuseable modal to the component library I’ve built. I have my template <p> <ng-template #messageModal let-closeModal=”close(‘Cross click’)”> <div id=”resultModal”> <div class=”modal-header”> <h4 class=”mt-3″>{{header}} </h4> <button id=”messageModalClose” type=”button” class=”close”

Continue reading

Angular call function inside forRoot method

Issue The problem is that I’m calling a function inside forRoot method like this: app.module.ts import {environment} from ‘../environments/environment’; … @NgModule({ imports: [ BrowserModule, MyModule.forRoot({ config: { sentryURL: environment.SENTRY_URL <– This, calls the function } }), HttpClientModule, … ]}) environemnt.ts

Continue reading

scss compilation issue in angular lib created using angular-cli

Issue Created(ng build my-lib) an angular lib with global scss then bundled into one file and copied to lib’s folder. dist-lib/my-lib/lib/sass/my-lib.scss Now my-lib.scss imports some resources like @font-face { font-family:”Roboto Regular”; font-weight:normal; font-style:normal; src: url(“../resources/fonts/roboto-regular/Roboto-Regular.eot?”) format(“eot”), /* IE9 Compat Modes

Continue reading

Angular 6 Library – Could not resolve entry

Issue I am getting the following error while building the angularlibrary project. Building Angular Package Building entry point ‘@abc/lib’ Compiling TypeScript sources through ngc Bundling to FESM2015 BUILD ERROR Could not resolve entry (C:\Dev\abc\build\dist-npm\esm2015\abc-lib.js) Error: Could not resolve entry (C:\Dev\abc\build\dist-npm\esm2015\abc-lib.js)

Continue reading

Library build fails with Angular 9

Issue I am trying to migrate this library https://github.com/flauc/angular2-notifications from Angular 2+ to Angular 9. The original error was about the ModuleWithProviders that has become a generic type, so I fixed it. I also had an error described here https://github.com/angular/angular/issues/32352

Continue reading

Angular library routing

Issue I try to set routing in my library. I have in lib-routing.module.ts: const routes: Routes = [ { path: ‘autologin’, component: AutoLoginComponent } ]; @NgModule({ declarations: [], imports: [ CommonModule, RouterModule.forChild(routes) ] }) export class LibRoutingModule { } And

Continue reading

NullInjectorError: No provider for ElementRef

Issue I created an internal directive in a module in my project (Angular 8 + Material Design). Following tuto and official doc. @Directive({ selector: ‘[button-confirmation]’ }) export class ButtonConfirmationDirective { @Output(‘bc-confirm’) confirmAction = new EventEmitter<any>(); @Input(‘bc-options’) options: Option[] = […];

Continue reading