search(): void {
    this.query = this.routeParams.get('query');
    if (!this.query) {
      return;
    }

    this.spotify
      .searchTrack(this.query)
      .subscribe((res: any) => this.renderResults(res));
  }
 ngOnInit() {
     let id: number = +this._routeParams.get('id')
     if( id > 0) {
         if(!this.contact || this.contact.id != id)
             this.contact = this._personService.getById(+id)
     } else if(id===-1) {
         this.contact = {id: null, firstName: '', lastName: '', email: ''}
         this.showEdit = true
     }
 }
  private _initModel(): void {
    let endpoint = '/users/' + this._routeParams.get('id')

    this._service
      .get(endpoint)
      .subscribe((user: User) => {
        user.birthday = this._datePipe.transform(user.birthday, 'DD/MM/YYYY')
        this.model = user
      })
  }
Example #4
0
    constructor(private movieData: MovieService,
                private params: RouteParams,
                private router: Router) {

        this.movieData.getById(params.get("id"))
            .subscribe(movie => {
                this.movie = movie;   
            });
        
    }
Example #5
0
  constructor(params: RouteParams, ngZone: NgZone) {
    var partyId = params.get('partyId');


    Tracker.autorun(() => {
      ngZone.run(() => {
        this.party = Parties.findOne(partyId);
      });
    });
  }
    ngOnInit() {

        this.chamada = {
            'id': null,
            'slug': "",
            'titulo': "",
            'texto': "",
            'midia': "",
            'aceitaInscricao': false
        };

        if (this._routeParams.get('slug') != null) {
            this.slug = this._routeParams.get('slug');
            this._chamadaService.findChamadaBySlug(this.slug).subscribe(res => this.chamada = res);
        }

        this.captura = { idChamada: null, email: "" };

    }
 ngOnInit() {
     let id = +this.routeParams.get('id');
     this.service.getMovie(id).then(movie => {
         if(movie){
             this.editRating = movie.rating;
             this.movie = movie;
         } else {
             this.gotoMovies();
         }
     });
 }
 // #docregion ngOnInit
 ngOnInit() {
   let id = +this._routeParams.get('id');
   this._service.getCrisis(id).then(crisis => {
     if (crisis) {
       this.editName = crisis.name;
       this.crisis = crisis;
     } else { // id not found
       this.gotoCrises();
     }
   });
 }
 ngOnInit() {
     let id = +this.routeParams.get('id');
     this.service.getShow(id).then(show => {
         if(show){
             this.editRating = show.rating;
             this.show = show;
         } else {
             this.gotoShows();
         }
     });
 }
Example #10
0
  constructor(params: RouteParams) {
    var partyId = params.get('partyId');
    this.party = Parties.findOne(partyId);

    let fb = new FormBuilder();
    this.partyForm = fb.group({
     name: [''],
     description: [''],
     location: ['']
    });
  }
 doSearch() {
     this.textSearch = this.routeParams.get('query');
     if (this.textSearch) {
         this._bookService.getBooks(this.textSearch)
             .subscribe(data => {
                 this.listResults = data;
             });
     }else{
         this._bookService.getAllBooks().subscribe(data => this.listResults= data);
     }
 }
Example #12
0
  //execute when component is initialized
  ngOnInit() {
    const id = +this.routeParams.get('id');
    // this.heroService.getHero(id)
    //   .then(hero => this.hero = hero);

    this.heroService.getHero(id)
      .subscribe( hero => {
        console.info('hero:', hero);
        this.hero = hero;
      });
  }
    ngOnInit() {     
        console.log("IsAuthorized:" + this.securityService.IsAuthorized);
        console.log("HasAdminRole:" + this.securityService.HasAdminRole);
        let id = +this._routeParams.get('id');

        if (!this.DataEventRecord) {
            this._dataEventRecordsService.GetById(id)
                .subscribe(data => this.DataEventRecord = data,
                error => this.securityService.HandleError(error),
                () => console.log('DataEventRecordsEditComponent:Get by Id complete'));
        } 
    }
	postReview(){
		let category = this.routeParams.get('category');
		this.productService.saveProductReviews(category, this.product.$key, {
			rating: this.reviewRating,
			review: this.reviewComment,
			reviewedByEmail: this.email,
			reviewedByUserName: this.userName,
			timeStamp: (new Date()).toUTCString(),
			likes: 0,
			dislikes: 0
		});
	}
 constructor(params:RouteParams, ngZone: NgZone) {
     this.orderId = params.get('orderId');
     Tracker.autorun(() => {
         ngZone.run(() => {
             this.order = Orders.findOne(this.orderId);
             this.order.isDone = _.findWhere(this.order.items, { isDone: false }) === undefined ? true : false;
             _.forEach(this.order.items, function(item) {
                 item.isDone = _.findWhere(item.actions, { isDone: false }) === undefined ? true : false;
             });
         });
     });
 }
Example #16
0
  constructor(params: RouteParams, private zone:NgZone) {
    super();
    let ticketId = params.get('ticketId');


    this.subscribe('ticket', ticketId, () => {
      this.autorun(() => {
        this.ticket = Tickets.findOne(ticketId);
      },   true);
    });

    document.title = "Editer un ticket - BDE - Support des laveries";
  }
	getPosts() {
		let id = this.routeParams.get('id');
    	this.postService.getPosts().subscribe(
    			data => {
    				let posts: Post[] = data
    				this.selectedPost = posts.filter(post => post.slug === id)[0]
    				if(this.selectedPost == undefined) 
    					this.router.navigate(['Grid']);
    				
    			},
    			error => console.log(error)
    		);
  	}
 ngOnInit() {
     this._kpiService.get(parseInt(this._params.get('id'))).subscribe(kpi => {
         this.kpi = kpi;
         let data : number[] = [];
         let labels : string[] = [];
         for(var i = kpi.values.length - 1, j = 0; i >= 0; i--, j++) {
             data[j] = kpi.values[i].value;
             labels[j] = kpi.values[i].date.date.toDateString();
         }
         this.chartData = [{data : data, label : kpi.unit}];
         this.chartLabels = labels;
     }, error => this.error = error);
 }
    init():void {
        this.pathId = parseInt(this.routeParams.get('path'));
        let operationId:number = parseInt(this.routeParams.get('operation'));

        this.apiDocService.getApi().subscribe((apiDoc:ApiDefinition) => {
            this.apiDoc = apiDoc;
            let path:PathsObject = this.apiDocService.apiDoc.paths[this.pathId-1];
            if(path) {
                this.operation = path.path.operations[operationId - 1];

                setTimeout(()=> {
                    this.operation.parameters.forEach((parameter:ParameterObject) => this.apiDetailForm.addControl(parameter.name,parameter.control));
                },0);

                if (!this.operation) {
                    this.router.navigate(['ApiDocList', {path: this.pathId}]);
                }
            } else {
                this.router.navigate(['ApiDocList', {path: this.pathId}]);
            }
        });
    }
 ngOnInit(): void {
     let id = this.routeParams.get('id');
     this._chatService
         .getChatroom(id)
         .subscribe(chatroom => {
             this.chatroom = chatroom;
             this.users = chatroom.users;
             this.chats = chatroom.chats;
             setTimeout(this.scrollDivDown, 300);
         });
         
     this.joinChatroom(id);
 }
 ngOnInit() {
     
     var formMode = this.routeParams.get('formMode'); 
     if (formMode == 'edit') {
         this.formTitle = "Edit";
         if (!this.builtWith) {
             let id = +this.routeParams.get('id');
             this._subscription = this.httpCRUDService.get(this.envConstants.apiEndPoint + 'crud', id)
                 .subscribe((result) => {
                     this.builtWith = result;
                 });
         }
     }
     else {
         this.formTitle = "New";
         this.builtWith = {
             name: '',
             pending: false,
             id: 0
         };
     }
     
 }
	ngOnInit(): void {
		this.resetPomodoro();
		setInterval(() => this.tick(), 1000);

		let taskIndex = parseInt(this.routeParams.get('id'));
		if (!isNaN(taskIndex)) {
			this.taskName = this.taskService.taskStore[taskIndex].name;
		}

		const anim = this.fadeInAnimationBuilder.start(
			this.elementRef.nativeElement.firstElementChild
			);
		anim.onComplete(()=> alert('blah'));
	}
Example #23
0
  constructor(
    private _builder: FormBuilder,
    private _tasksService: TasksService,
    public params: RouteParams
  ) {
    const task = _tasksService.getById(params.get('id'));

    this.taskEditForm = _builder.group({
      _id: [task._id, Validators.required],
      owner: [task.owner, Validators.required],
      description: [task.description, Validators.required],
      done: [task.done]
    });
  }
 constructor(private accountService: AccountService, private router: Router, private routeParams: RouteParams, private tripsService: TripsService) {
   if (!accountService.isLoggedIn) {
     router.navigate(['/Login']);
     return;
   }
   if (routeParams.get('tripStatus') === 'new') {
     this.tripsService.activeTrip = new Trip();
   }
   if (tripsService.activeTrip.id) {
     let t: Trip = new Trip();
     t.deepClone(tripsService.activeTrip);
     tripsService.activeTrip = t;
   }
 }
 private _applyValidators() {
   this.form = this._formBuilder.group({
     name: ['', Validators.compose([
       Validators.required
     ])],
     email: ['', Validators.compose([
       Validators.required,
       NbValidators.email
     ]), NbValidators.unique(this._emailService, this._routeParams.get('id'))],
     birthday: ['', Validators.compose([
       NbValidators.date
     ])]
   })
 }
Example #26
0
  ngOnInit (): any {
    let user: IUser = this.loginSvc.getUser();
    let id = +this.routeParams.get('id');
    if (!user || !user.isLoggedIn || (user.type !== 'admin')) {
      return this.router.navigate(['View']);
    }

    if (id && +id >= 0) {
      this.survey.id = +id;
      this.surveySvc.fetchSurvey(this.survey.id).subscribe();
    } else {
      return this.router.navigate(['List']);
    }

  }
Example #27
0
  constructor(params: RouteParams) {
    super();
    var partyId = params.get('partyId');

    this.subscribe('party', partyId, () => {
      this.autorun(() => {
        this.party = Parties.findOne(partyId);
        this.getUsers(this.party);
      }, true);
    });

    this.subscribe('uninvited', partyId, () => {
      this.getUsers(this.party);
    }, true);
  }
 ngOnInit() {
   let id = this._routeParams.get('id');
   this._service.get(id).subscribe(result => {
     console.log(result);
     this.lake = result;
   });
   // this._service.get(id).then(lakes => {
   //   if (lakes) {
   //     this.editName = lakes.name;
   //     this.lakes = lakes;
   //   } else {
   //     this.gotoList();
   //   }
   // });
 }
Example #29
0
  ngOnInit() {

    let code = this.routeParams.get("code");
    if (code) {
      this.subjectService.getSubject(code).subscribe(sub => {
        this.subject = sub;
        // Filter Students
        this.students = this.subject.users.filter((usr) => {
          return usr.role === "Student";
        });

        this.mapTasks();
      });
    }
  }
	constructor(private params: RouteParams) {
		super();
		this.subscribe('project', params.get('projectId'), () => {
			this.autorun(() => {
				this.project = Projects.findOne(params.get('projectId'));
			}, true);
		});
		this.items = [
			new Item('User details', ['/ProjectUsersDetails', { projectId: params.get('projectId') }], 'Navigate to user details'),
			new Item('Project Groups', ['/GroupsList', { projectId: params.get('projectId') }], 'Navigate to project groups'),
			new Item('Task list', ['/TasksList', {projectId: params.get('projectId')}], 'Navigate to task list'),
			new Item('Task i am working on', ['/WorkingTasksList', { projectId: params.get('projectId') }], 'Navigate to the list of task i am working on'),
			new Item('Task i own', ['/MyTasksList', { projectId: params.get('projectId') }], 'Navigate to the list of tasks i have created'),
			new Item('Add task', ['/TaskForm', { projectId: params.get('projectId') }], 'Navigate to task form to create new task')
		];
	}