17.10.2018 Views

Angular

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}<br />

getLogin(form: LoginForm): void {<br />

let username = form.email;<br />

let password = form.password;<br />

this.loginService.getAuthenticate(form).subscribe(() => {<br />

this.router.navigate(['/calender']);<br />

});<br />

}<br />

We need to export this component to in index.ts.<br />

export * from './login/login.component';<br />

we need to set routes for login in app.routes.ts<br />

const appRoutes: Routes = [<br />

{<br />

path: 'login',<br />

component: LoginComponent<br />

},<br />

........<br />

{<br />

path: '',<br />

pathMatch: 'full',<br />

redirectTo: '/login'<br />

}<br />

];<br />

In root component, app.module.ts file you just need to import that component.<br />

.....<br />

import { LoginComponent } from './modules';<br />

......<br />

@NgModule({<br />

bootstrap: [AppComponent],<br />

declarations: [<br />

LoginComponent<br />

.....<br />

.....<br />

]<br />

.....<br />

})<br />

export class AppModule { }<br />

and after that npm install and npm start. Here, you go! You can check login screen in your localhost. In case of any<br />

difficulty, You can refer the angular4-boilerplate.<br />

Basically I can feel less building package and more faster response with <strong>Angular</strong> 4 application and Although I found<br />

Exactly similar to <strong>Angular</strong> 2 in coding.<br />

GoalKicker.com – <strong>Angular</strong> 2 Notes for Professionals 19

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!