Categories
Development

How to change routing in module.ts depending on value from a service?

I have a routing module routing.module.ts file where I want to change the redirectTo path depending on if the user is an admin or not. My idea is to use a service to capture and hold the value and that will help maintain where it should go but it is not changing. I tried many […]

Categories
Development

Trying to implement react-transition-group into react-router generates error : ‘Element type is invalid …’

I am trying to use CSSTransition component from react-transition-group module to implement page transitions as a user switches from one route to another. From my code tested below, it generates the following error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot […]

Categories
Development

Angular child route with ID not doing anything

First off my apology for the ‘noobish’ question, but I have digged through all solutions yet I can’t figure it out. My childroute isn’t working. When I click the link it doesn’t throw an error nor redirects so I don’t know how to debug this. This is in my app-routing.module.ts: const routes: Routes = [ […]

Categories
Development

Invalid url in Angular should check some condition before redirecting

My initial domain is localhost:4200 and which in redirects me to some page, based on my routing, but I want to input an invalid domain for example localhost:4200/Whasup or localhost:4200/Whasdown, where Whasup and whasdown page doesn’t exist. Before i get redirected to default Angular 404 page, I need to check some conditions. And if my […]

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

Is it the right way to auth?

I’m new to vue 2.0 -node.js express This is my actual vue.js – node way of authenticating, with express-sessions . I wonder if this is the right way to do, and if this code is subject to hacking . PHASE 1 : The node.js server is receiving email+password, then, if the user gets authenticated, store […]

Categories
Angular Development

angular can’t find module untill rebuild

I have this very odd problem where i have the force my angular to “rebuild” (by changing something in the file and reloading the serve) Before my route can be reached Here is my folder structure: app-routing.module.ts import {NgModule} from ‘@angular/core’; import {PreloadAllModules, RouterModule, Routes} from ‘@angular/router’; import {redirectUnauthorizedTo, canActivate} from ‘@angular/fire/auth-guard’; const redirectUnauthorizedToLanding = […]

Categories
Development

Property binding matFooterRowDef not used by any directive on an embedded template

I am new to Angular Material, I wanted to add a mat-footer-row to my table after the mat-row but upon adding the cell definition, I am getting the below error message **Property binding matFooterRowDef not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives […]

Categories
Development Vue

Vuex store/navigation guard doesn’t work first time

I have a navigation guard on a user’s dashboard which requires a user to exist to proceed. export default new Router({ routes: [ { path: ‘/’, name: ‘home’, component: Home }, { path: ‘/dashboard’, name: ‘dashboard’, component: Dashboard, beforeEnter: (to, from, next) => { const user = JSON.parse(store.state.authenticatedUser) if(user) { console.log(“Route accepted.”) next() } else […]

Categories
Angular Development

How to make timer component running while switching routes in angular?

I have a timer(counter) component and use it in my dashboard.html. The program is about to see how much time left until the client arrives. How can I make my timer keep running when I am switching routes instead of resetting it to defautlt? dashboard.html <div class=”text-center”> <h1 class=”bc”>Welcome !</h1> <div class=”row” *ngIf=”appUser && appUser?.loggedIn […]