0

Angular js 2 routing is happening but nothing changing in url

hai all,

Am new to angular js 2 and i have created routing example with three tab they are different type of forms in angular js 2.. 1.Template driven 2.The model driven 3.The model driven with form builder

enter image description here

issue is when i click another tab file content changes but url,validation are not working

I have uploaded entire content in github Am glad if someone helps me to clean that code also. Am am also looking for contributor for that form templates

Thanks in advance here is the code for routing in app.component.ts

<nav>
            <a routerLink="/angulartemplateform" routerLinkActive="active">Angular Forms Using Template</a>
            <a routerLink="/angularmoduleformdata" routerLinkActive="active">Angular Forms Using Model</a>
            <a routerLink="/angularmodulebuilder" routerLinkActive="active">Angular Forms Using Form Builder</a>
          </nav>              
          <router-outlet></router-outlet> 

Github Url ::https://github.com/selva1990kumar/AngularJS-Forms

1 Answer 1

1

It is because you have not set any for empty route path

const routes: Routes = [
     //////////////////////////////////////////////////////////////////////
      { path: '', redirectTo: 'angulartemplateform', pathMatch: 'full' },
     ///////////////////////////////////////////////////////////////////////
      { path: 'angulartemplateform', component: EmployeeListComponent},
      { path: 'angularmoduleformdata', component: EmployeeDetailComponent},
      { path: 'angularmodulebuilder', component: EmployeeFormComponent},


    ]
Sign up to request clarification or add additional context in comments.

4 Comments

{ path: '', redirectTo: 'angulartemplateform', pathMatch: 'full' }, i have tried the above code but its not working also problem is it goes to the angularmoduleformdata,angularmodulebuilder link and return back to angulartemplateform
angulartemplateform:1 Refused to execute script from 'localhost:3000/app/app-routing.module.ts' because its MIME type ('video/mp2t') is not executable. popup.js:121 Uncaught ReferenceError: XML is not defined at popup.js:121 (anonymous) @ popup.js:121 core.umd.js:210 Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode. This is the error which i get when i load project
yes. the error message is very straight forward beyond this what you want from me :)!
thank u so much Aravind boss i have fixed it .am really sorry for late reply

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.