I have made an login application in angular 2 and its working...
My app.ts
import {bootstrap, Component} from 'angular2/angular2';
import {DemoForm} from './form';
//import {FormBuilder, ControlGroup} from "angular2/angular2";
@Component({
selector: 'my-app',
template: `
<demo-form></demo-form>
`,
directives:[DemoForm]
})
class AppComponent {
constructor(){}
}
bootstrap(AppComponent,[]);
and my form.ts
import {Component, View, FORM_DIRECTIVES} from 'angular2/angular2';
@Component({
selector: 'demo-form'
})
@View({
directives: [FORM_DIRECTIVES],
template: `
<div>
<form #f="form" (submit)="onSubmit(f)">
<div class="form-group">
<label for="id">id</label>
<input type="text" class="form-control" ng-control="id" placeholder="id" required>
</div>
<div class="form-group">
<label for="name">name</label>
<input type="text" class="form-control" ng-control="name" placeholder="name" required>
</div>
<button type="submit" class="btn btn-default" [disabled]="!f.valid">Submit</button>
</form>
<hr>
submitted : {{submitted|json}}
</div>
`
})
export class DemoForm {
private submitted:object = {};
onSubmit(f) {
this.submitted = f.value;
}
}
and when submitted i my username and password will in json format as
submitted : { "id": "Test", "name": "password" }
Now i have to send the username and password from my Angular application to spring boot controller...
so that i can use that username and password in my back-end...
i have no idea how to start it.. so if you have some tutorials and or simple plunker example that can help me with this.. share it