Categories
Mastering Development

Unable to resolve signature for pipe invocation in vscode by Angular Language Service

I have a pipesModule in Angular library project when I import the module to another project, I got an error tip: Unable to resolve signature for pipe invocation in vs code, it still works, build without errors, but I have no idea how to fix it, I got so many red lines… Now, the error […]

Categories
Mastering Development

Unable to override MockStore

I used provideMockStore for unit testing more than one selector. I need to override the MockStore for one of the test cases. Code is as follows. It is not overriding the store. I have seen documentation there it is mentioned that mockStore = TestBed.inject(MockStore). It throws error that reads “Property ‘inject’ doesn’t exist on type […]

Categories
Mastering Development

Angular 8 Child Routes not working from component

I have a strange issue, I’ve cloned ngx-admin and trying to use the theme as base theme. I’ve created Layout Components with Modules with Routing enabled. Created routes and connected components but the problem is routes are working fine if I open them from link directly. But when I try to use router.navigate to redirect, […]

Categories
Development

Angular HttpClientModule undefined

I can’t get the HttpClientModule, the following error appears while loading this ModuleType. I get this error in the registerNgModuleType method from Angular. function registerNgModuleType(ngModuleType) { if (ngModuleType.ɵmod.id !== null) { /** @type {?} */ const id = ngModuleType.ɵmod.id; /** @type {?} */ const existing = (/** @type {?} */ (modules.get(id))); assertSameOrNotExisting(id, existing, ngModuleType); modules.set(id, […]

Categories
Development

Routes defined in Angular 8 sub-module not evaluated during app startup

Since upgrading to Angular 8, my SPA is behaving a bit differently when loading the whole app with a given hash. When loading #/public/signup, the app will redirect to #/trips/home. My app is modularized, and app.route.ts only defines: const routes: Routes = [ { path: ”, pathMatch: ‘full’, redirectTo: ‘trips/home’ }, { path: ‘**’, redirectTo: […]

Categories
Development

TypeError: Cannot read property ‘get’ of undefined (Fixed conflicting imports not working)

Getting an error when trying to run karma TS spec file. All modules and imports seem to be working fine with no conflicts. Tried adding component.ngOninit() into beforeEach() and it() and have not has any success … Looking at similar issues were related to conflicting a HttpClientTestingModule import or other providers/declarations conflicts. I have not […]

Categories
Development

Angular cli router is not changin browser url on Router.navigate

I made my angular project locally, and all works fine, if i deploy it on a shared hosting server router seems broken. I made an auth guard service as router guard, and if user is not authenticated redirect to main page, the problem is that on redirect app render the main page component, but doesn’t […]

Categories
Angular Development HTTP

Wait for http get request is finished before ngoninit starts angular

Summary I have an application on Angular. There are i have three components: root, child1 (tabs.component.ts) and child2 (io.component.ts). Also, i have a service that sends get and post requests to tomcat server. In child1 i have a ngoninit, where i invoke service method get. Also i have ngoninit in child2. Ngoninit from child1 starts […]

Categories
Development

@NgModule static forRoot when implementing dynamic modules

I have this code in @NgModule: @NgModule({ declarations: [ AppComponent, DashboardComponent ], imports: [ BrowserModule, BrowserAnimationsModule, ClarityModule, RouterModule.forRoot([ { path: ”, redirectTo: ‘dashboard’, pathMatch: ‘full’ }, { path: ‘dashboard’, component: DashboardComponent }, ], {useHash: true}), LibraryTestModule.forRoot(ServicetestService), HttpModule ], If you can see i am injecting the ServicetestService to the LibraryTestModule. But in my case i […]

Categories
Development

Keep Getting NullInjectorError: No provider for Injector! when trying to work with a store

I am creating a web app that uses a store. I am following the tutorial: https://coursetro.com/posts/code/151/Angular-Ngrx-Store-Tutorial—Learn-Angular-State-Management. The problem is that I keep having the following issue: main.ts:13 NullInjectorError: StaticInjectorError(AppModule)[InjectionToken @ngrx/store Initial Reducers -> Injector]: StaticInjectorError(Platform: core)[InjectionToken @ngrx/store Initial Reducers -> Injector]: NullInjectorError: No provider for Injector! I believe it has to do with StoreModule.forRoot({})… here […]