!DJCaZMEJBuQXnQdkPy:matrix.org

Angular

181 Members
Discussion for angular (2+) - need help? create a stackblitz with your issue to get help faster using this template: https://stackblitz.com/fork/angular-issue-repro22 Servers

Load older messages


Timestamp Message
26 May 2020
09:43:02@gitter_aubrey-fowler:matrix.orgAubrey Quinn (Gitter) @rraziel OK I'll have a look. i18next has Typescript support now.
09:43:30@gitter_buntybru:matrix.orgBuntyBru (Gitter) joined the room.
09:43:32@gitter_buntybru:matrix.orgBuntyBru (Gitter) So i have been checking this code written by an ex-dev
just wanted to know how to stop input in a bar when the no of entries exceed the no of characters allowed
09:43:41@gitter_buntybru:matrix.orgBuntyBru (Gitter)The guy is using reactive forms
09:43:47@gitter_buntybru:matrix.orgBuntyBru (Gitter)validators
09:45:01@gitter_buntybru:matrix.orgBuntyBru (Gitter)
this.userDematForm = this.formBuilder.group({
      id: [null],
      type: ['NSDL', Validators.required],
      accountNumber: [
        '',
        [
          Validators.required,
          Validators.minLength(16),
          Validators.maxLength(16),
        ],
      ],
      activeFlag: [true],
    })
09:45:17@gitter_buntybru:matrix.orgBuntyBru (Gitter)i am passing minlength and maxlength
09:46:01@gitter_buntybru:matrix.orgBuntyBru (Gitter)
 <input class="input kyc-textbox is-primary" 
                        formControlName="accountNumber" type="text" />
10:04:07@gitter_haneatic:matrix.orghaneatic (Gitter) @BertrandMarechal ah I see, thank you!
11:17:22@gitter_haneatic:matrix.orghaneatic (Gitter)

I've two functions which return an observable through using the of operator, e.g. return of({...someJSON}), example:

  public getAllItems(): Observable<Items[]> {
    return of(ItemMock as Items[]);
  }

Can I not feed such a function into a forkJoin? e.g.

11:18:31@gitter_haneatic:matrix.orghaneatic (Gitter) (edited) ... forkJoin? e.g. => ... forkJoin? e.g. ```js forkJoin({ items: this.dataService.getAllItems, }).subscribe(response => { this.isLoading = false; console.log(response); }); ``` This shows the error: > ERROR TypeError: You provided 'function () {}' where a stream was expected. You can provide an Observable, Promise, Array, or Iterable. The error is indicating that it is due to the way I am importing the ItemMock, which is a json file
11:20:24@gitter_haneatic:matrix.orghaneatic (Gitter) (edited) I've two functions which return an observable through using the of operator, e.g. return of({...someJSON}), example: ```js public getAllItems(): Observable<Items[]> { return of(ItemMock as Items[]); } ``` Can I not feed such a function into a forkJoin? e.g. ```js forkJoin({ items: this.dataService.getAllItems, }).subscribe(response => { this.isLoading = false; console.log(response); }); ``` This shows the error: > ERROR TypeError: You provided 'function () {}' where a stream was expected. You can provide an Observable, Promise, Array, or Iterable. The error is indicating that it is due to the way I am importing the ItemMock, which is a json file =>
11:26:04@gitter_buntybru:matrix.orgBuntyBru (Gitter)can anyone help
11:26:04@gitter_buntybru:matrix.orgBuntyBru (Gitter)?
11:26:23@gitter_bertrandmarechal:matrix.orgBertrandMarechal (Gitter)Hey
11:26:53@gitter_bertrandmarechal:matrix.orgBertrandMarechal (Gitter)the approach I would take would be as follow :
11:28:55@gitter_bertrandmarechal:matrix.orgBertrandMarechal (Gitter) subscribe to this.userDematForm.get('accountNumber').valueChanges, check if the control is not valid and if the error is maxLength. if so, then set the value of the control to this.userDematForm.get('accountNumber').value.substr(0, 16)
11:42:11@gitter_buntybru:matrix.orgBuntyBru (Gitter)but that wont restrict the input
11:51:46@gitter_rraziel:matrix.orgRaziel (Gitter) @aubrey-fowler TypeScript support for such a lib is not much useful with Angular since you'll likely just use translation identifiers in your templates
11:52:15@gitter_rraziel:matrix.orgRaziel (Gitter) It's more about having the right stuff to be part of the Angular component lifecycle, using observables to subscribe to translation changes, etc
11:57:20@gitter_habibatify_twitter:matrix.orghabibaatify (Gitter) joined the room.
11:57:21@gitter_habibatify_twitter:matrix.orghabibaatify (Gitter)hello
11:57:38@gitter_habibatify_twitter:matrix.orghabibaatify (Gitter)why input not recognized in this code?
11:59:24@gitter_habibatify_twitter:matrix.orghabibaatify (Gitter)

import { Component, OnInit } from '@angular/core';
import * as Highcharts from 'highcharts';
import HC_exporting from 'highcharts/modules/exporting';

@Component({
selector: 'app-widget-area',
templateUrl: './area.component.html',
styleUrls: ['./area.component.css']
})
export class AreaComponent implements OnInit {
chartOptions:{};
Highcharts = Highcharts;
@Input() data = [];

constructor() { }

ngOnInit(): void {

this.chartOptions = {
chart: {
type: 'area'
},
title: {
text: 'COVID19 Response Monitoring '
},
subtitle: {
text: 'Source: '
},

tooltip: {
    split: true,
    valueSuffix: ' millions'
},
credits:{
  enabled:false,
},
exporting:{
  enabled:true,
},
plotOptions: {
    area: {
        stacking: 'normal',
        lineColor: '#666666',
        lineWidth: 1,
        marker: {
            lineWidth: 1,
            lineColor: '#666666'
        }
    }
},
series: [{
    data:this.data
}]

};
HC_exporting(Highcharts);
setTimeout(() => {
window.dispatchEvent(
new Event('resize')
);

}, 300);
}
}

12:26:12@gitter_bojankogoj:matrix.orgBojan Kogoj (Gitter)Please make stackblitz example
12:26:29@gitter_habibatify_twitter:matrix.orghabibaatify (Gitter)how ?
12:27:06@gitter_habibatify_twitter:matrix.orghabibaatify (Gitter) var code = "formatted";
12:27:31@gitter_bojankogoj:matrix.orgBojan Kogoj (Gitter) https://stackblitz.com/fork/angular-ivy add your code and give us link
12:28:23@gitter_bojankogoj:matrix.orgBojan Kogoj (Gitter) When you say "input not recognized", you mean import?
12:28:56@gitter_bojankogoj:matrix.orgBojan Kogoj (Gitter) You should add Input to @angular/core import

There are no newer messages yet.


Back to Room List