javascript - Angular 2 - No errors, but application is not loading properly too -
i new angular , have started angular 2. have started sample project working fine, stops working. not showing output browser. below code.
index.html
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>bulletin board</title> <base href="/"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="icon" type="image/x-icon" href="favicon.ico"> </head> <body> <app-root>loading...</app-root> </body> </html>
app.component.ts
@component({ selector: 'app-root', templateurl: './app.component.html', styleurls: ['./app.component.css'] }) export class appcomponent { constructor() { } title = 'app'; }
app.module.ts
const approute: routes = [ { path: '', redirectto: '/login', pathmatch: 'full' }, {path: 'login', component: usercomponent}, {path: 'registration', component: userregistrationcomponent} ]; @ngmodule({ declarations: [ appcomponent, usercomponent, userregistrationcomponent ], imports: [ routermodule.forroot(approute), browsermodule ], providers: [], bootstrap: [appcomponent] }) export class appmodule { }
edit
app.component.html
<router-outlet></router-outlet>
user.component.ts
<div class="login-box"> <div class="login-logo"> <b>bulletin</b>board </div> <div class="login-box-body"> <div class="form-group has-feedback"> <input type="text" #txtusername class="form-control" placeholder="usrename or email"> <span class="glyphicon glyphicon-envelope form-control-feedback"></span> </div> <div class="form-group has-feedback"> <input type="password" #txtpassword class="form-control" placeholder="password"> <span class="glyphicon glyphicon-lock form-control-feedback"></span> </div> <div class="row"> <div class="col-xs-8"> <div class="checkbox icheck"> <label> <input type="checkbox"> remember me </label> </div> </div> <div class="col-xs-4"> <button type="submit" class="btn btn-primary btn-block btn-flat" (click)="onbuttonclick(txtusername.value,txtpassword.value)">sign in</button> </div> </div> <a routerlink="/registration" class="text-center">register new membership</a> </div> </div>
now not able figure out happening , error, , unable output.
what changes needs do?
you dont have script includes load angular or other script file. templates use following setup in index.html. adjust according setup:
<head> <meta charset="utf-8"> <base href="/"> <!-- polyfill(s) older browsers --> <script src="node_modules/core-js/client/shim.min.js"></script> <script src="node_modules/zone.js/dist/zone.js"></script> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="node_modules/reflect-metadata/reflect.js"></script> <script src="systemjs.config.js"></script> <script> system.import('app').catch(function(err){ console.error(err); }); </script> </head>
Comments
Post a Comment