SHARE
TWEET

Untitled

a guest Apr 10th, 2018 133 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //HTML
  2.       <div class="form-group">
  3.         <label for="project">Project</label>
  4.         <select name="dev_team_id" [(ngModel)]="dev_team_id" (ngModelChange)="vsiUserjiZaProjekt(dev_team_id)" class="form-control" id="project" name="project">
  5.               <option value="none">Select Project</option>
  6.               <option *ngFor='let project of allProjects' value="{{project._id}}">{{project.title}}</option>          
  7.         </select>
  8.       </div>
  9.  
  10. //MODULE
  11.   allUsers(id) {
  12.     this.service.getTeam(id)
  13.     .then(data => {
  14.       this.development_team = data;
  15.     }).then(data => console.log(this.development_team));
  16.   }
  17.  
  18. //it works with static parameter, passed like this
  19.   allUsers(id) {
  20.     this.service.getTeam('5acc886f8066b119f4aaa0f2')
  21.     .then(data => {
  22.       this.development_team = data;
  23.     }).then(data => console.log(this.development_team));
  24.   }
  25.  
  26. //SERVICE
  27.  
  28. getTeam(id) {
  29.         var url = this.hostname + '/team/' + id;
  30.         return new Promise(resolve => {
  31.             this.http.get(url)
  32.                 .map(res => res.json())
  33.                 .subscribe(data => {
  34.                     resolve(data);
  35.                 });
  36.         });
  37.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top