angular5

'object' does not contain such a member Angular 5

梦想的初衷 提交于 2019-12-24 10:36:07
问题 I am new to Angular and trying to make a small application. I referred 'object' does not contain such a member answer but I am not getting my solution from there. profile.component.ts import { Component, OnInit } from '@angular/core'; import { AuthService } from '../../services/auth.service'; import { Router } from '@angular/router'; @Component({ selector: 'app-profile', templateUrl: './profile.component.html', styleUrls: ['./profile.component.css'] }) export class ProfileComponent implements

Angular 5 glue logic of components dynamically added to form

北城余情 提交于 2019-12-24 10:26:45
问题 I'm using Angular 5 and I need to create a component ( dynform ) that will instantiate a set of custom components ( dyncompA , dyncompB , etc.). Which ones is decided at dynform.ngOnInit , so they're not declared in the parent's template but added dynamically. Each child component holds a value of type MyObjectA , MyObjectB , etc. derived from MyObjectAbstract (not string) for which I implemented a ControlValueAccessor interface. The problem I get is that the parent form is never notified

Angular return value from subscribe

人盡茶涼 提交于 2019-12-24 10:26:06
问题 I need to return value from subscribe of a service call. here is my code export class RideDataSource extends DataSource<any> { rides: Ride[]; constructor(private _rideService: RidesService, private _paginator: MatPaginator) { super(); } connect(): Observable<Ride[]> { this._rideService.getActiveRides(this._paginator.pageIndex, this._paginator.pageSize).subscribe( ridePage => { this.rides = ridePage.content; this._paginator.length = ridePage.totalElements; } ); // i need to return Observable

Observable of array with filter using Angular 5 with RxJS

▼魔方 西西 提交于 2019-12-24 09:39:16
问题 I'm creating a simple forum. I'm looking to filter the posts. I have some trouble with .pipe and .filter in RxJS. I'm trying to: Retrieve the list of in-memory-api posts from api/posts , which when used with http.get it returns an Observable<Post[]> Iterate through each Post in the Observable<Post[]> and filter it so it only selects, says, each post with an id of 1 (only one post with id 1 exists). Log to the console any errors or if the function had success The filter does not select each

Angular EventEmitter from component to app.component

我与影子孤独终老i 提交于 2019-12-24 08:57:55
问题 I would like to bind an event emitter from a child to a parent component, but the parent component is the 'app.component'so i assume that the relationship between the two is not declared but implicit. in this answer , i see how to add an event emitter to a child that has been explicitly declared as such, in his parent: <child (notifyParent)="getNotification($event)"></child> But in my app, the child component (lets call id: child), is not declared in that way, but its declared in the app

Navigate to last visited child route when entering parent route Angular 5

♀尐吖头ヾ 提交于 2019-12-24 08:50:07
问题 In my Angular 5 application I have my router configured as this: { path: 'system-variables', component: SystemVariablesComponent, children: [ { path: '', redirectTo: 'partners-variables', pathMatch: 'full' }, { path: 'partners-variables', component: PartnersVariablesComponent, children: [ { path: '', redirectTo: 'partners-branches', pathMatch: 'full' }, { path: 'partners-branches', component: PartnersBranchesComponent, children: [ { path: '', redirectTo: 'register-partners-branches',

How to validate input fields one by one in Angular 6

半城伤御伤魂 提交于 2019-12-24 08:46:43
问题 I am new to angular here I am trying to validate a small form .In this case everything is working fine . What I want to do is if a user click on SAVE button without touching the form fields I want to display the error message in the first field only instead of all the fields. Now it's showing error message in all the fields which spoils the look and feel. So how to show the error message on first filed if the user clicked on SAVE button without enter anything in form.It should work if the

Primeng calendar: Set date from database

馋奶兔 提交于 2019-12-24 08:38:24
问题 I'm using primeng calendar but i can't set the date from database. This is my date from server: 2018-04-17T16:41:47.683 When i try to change format to "YYYY.MM.DD HH.MM" witht moment, i get this error on console: Uncaught (in promise): Unexpected literal at position 2 When i convert my datetime to string, i get same error and i don't know what to do. Please help Here is my code: Component.html <p-calendar id="StartDate" inputStyleClass="form-control" [showIcon]="true" showTime="true"

How to prevent Heroku Logs show old logs?

旧巷老猫 提交于 2019-12-24 08:29:18
问题 I'm not sure why I lead my heroku logs command to this state. It kept showing old logs. I tried to fix it by attempting these : heroku drains heroku logs I still see app[api]: Release v1 created by user username@outlook.com app[api]: Initial release by user username@outlook.com app[api]: Release v2 created by user username@outlook.com app[api]: Enable Logplex by user username@outlook.com app[api]: Build started by user username@outlook.com app[api]: Deploy f4f63e5d by user username@outlook

Window object in angular 5 service

会有一股神秘感。 提交于 2019-12-24 08:05:06
问题 I have project in Angular, user's panel in specific. All page is in php, just panel in angular. How to use window object in service? I want use window.location exactly for the same action as href="/" in HTML, which return me to outside the angular project(panel) to main site. Why? When I was trying get user and it returns status for example 401, 404 user can not get access to panel, and it must navigate to main site. I tried several options with route navigate or navigateByURl , but address