0

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

3
  • I would suggest you read about client server architectures and http first. :) Commented Mar 22, 2017 at 8:22
  • Here is a link to the relevant part of Angular's introduction tutorial: angular.io/docs/ts/latest/tutorial/toh-pt6.html If you haven't done it yet I would highly suggest you to do it :) Commented Mar 22, 2017 at 8:28
  • your spring boot app is just like any other backend: it exposes endpoints, that you may call from anywhere and anything that supports http requests Commented Mar 22, 2017 at 8:29

1 Answer 1

3

You don't have to find an A-Z document on how to do it. You can learn pieces at a time.

Basically, you need to have:

Other links

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

1 Comment

Please consider providing another link for the angular forms.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.