Most voted "typescript" questions
Typescript is a super superset of Javascript created by Microsoft that adds optional types, classes, interfaces and modules and compiles for pure Javascript.
Learn more…1,167 questions
Sort by count of
-
1
votes0
answers73
viewsI cannot do Array (in JSON) in Typescript
Below is the Array I need: [ { "id":1, "nome":"LESPAUL", "validade":1525568400000, "dataGerada":1525914000000, "status":true, "itens":[ { "cliente":{ "id":1, "login":"gabriel", "senha":"123",…
-
1
votes1
answer181
viewsMultiple Dependent Requests at Angular
Hello, I’m doing a process at the angular, in the 'ngOnInit()' method, where I need to perform 3 HTTP methods, which are asynchronous. one depends on the other’s answer. for example: 1° call: get a…
-
1
votes0
answers44
viewsJS condition printing <div> HTML
I am wanting to create a condition in JS that I get an object in a file .html as follows: <a each="gabarito in $this.gabaritosCopy"> <script> if (gabarito.valor == 'N') { </script>…
-
1
votes1
answer41
viewsTSLINT - Private variable rule
Is there any rule in tslint to define what a private variable needs to have _ (underline) before the name? Example: private _router: Router,
typescriptasked 5 years, 1 month ago Guilherme Nass 939 -
1
votes1
answer780
viewsHow to list files in a directory and use in an Angular2 + Webpack project
Hello, I am creating a project in Angular2 + Webpack and in this project I use as a design library @angular/material. So I can create my own icons using SVG, I’m extending the component MatIcon as…
-
1
votes1
answer139
viewsAccess a property of a saved object in localstorage
After logging in, I saved a user’s id and token to my localStorage via a currentUser-named object. How can I access the id and token property of this object when recovering from localStorage? What I…
-
1
votes1
answer68
viewsFirebase: Filter Child Node query on Angularfire2 firebase
I have this following structure: { "3" : { "data" : "2017-09-21", "fornecedor" : { "cnpj" : "123234534534", "fantasia" : "Barreirinha" }, "nNF" : 3, "peso" : 3, "precoCompra" : 6, "vendido" : false…
-
1
votes1
answer172
viewsCollection "@angular/material" cannot be resolved
I’m starting with angular and I ended up encountering very strange error while trying to execute the command: ng generate @angular/material:material-nav --name nav-menu he introduces me to the…
-
1
votes0
answers190
views"Cannot set Property 'classname' of null" error function Angular 2+
In my template I have a button that calls the login function: <button type="submit" name="entrar" (click)="fazerLogin()" routerLink="/home" class="login"…
-
1
votes1
answer691
viewsRescue data from another angular component
I have a component called login that when you login fills the user object data, I need to take the "job" field of this object and receive in another component. I tried to: login.componentts.: public…
-
1
votes0
answers80
viewsToastcontainer - Error giving build --Prod
When I run the project in dev works perfectly, when I try to give the build in Prod, of that mistake... WARNING in Invalid Animation value at 221:41. Ignoring. < That one I solved ERROR in Error…
-
1
votes1
answer79
viewsField returning date in Brazilian standard and the other in American in typescript. How to validate?
I have a field validation problem, in which when the date returns from my API in American format is made the conversion to Brazilian as below: formatDate(date: string) { if (!date) { return '-' }…
-
1
votes1
answer219
viewsTypescript error: Type 'K' cannot be used to index type’T'
I’m starting with Typescript and I stalled at the time of typing the following function: const pickProp = prop => obj => obj[prop] I’m trying this way: const pickProp = <K>(prop: K)…
-
1
votes2
answers1094
viewsTypeerror: Cannot read Property 'Concat' of Undefined - Typescript?
if (dataFindCategories && dataFindCategories.length !== 0) { let dataFindProducts: Product[]; dataFindCategories.forEach((category) => {…
-
1
votes1
answer643
viewsCall delete at angle 6
I have this HTML <div class="container-fluid"> <div class="row"> <div class="col-md-12"> <table class="table table-striped table-bordered table-hover"> <caption>Lista…
-
1
votes2
answers289
viewsCreate a new object with the type received by parameter
I have the following generic class: class Generic<T> { } How do I create an object with received type? Something like this: class Generic<T> { item: T = new T(); // isso é um exemplo,…
-
1
votes1
answer279
viewsCreate similar C# dictionary in Typescript?
I have the following dictionary in C#: Dictionary<string, List<string>> ls = new Dictionary<string, List<string>>(); ls.Add("chave1", new List<string>());…
-
1
votes0
answers20
viewsUpdate(Put) on my project does not write to BD(Mongodb)
I need to make an editing screen and I’m not getting it. See how my Component is doing(I’ve eliminated Imports to save space) @Component({ selector: 'app-operators', templateUrl:…
-
1
votes1
answer190
viewsHow can I remove an array value by clicking on the typescript checkbox
I have a checkbox that when clicked makes a push in an array of name perm_telas, but when I select again a check already selected it is not removing correctly the value of the array. I tried…
-
1
votes0
answers153
viewsUse Promise when uploading files in Angular and Node.js
Good afternoon guys, I am with a registration form in homologation, but when I upload an image and a pdf file in the first moment my request returns that I have not filled all the data, but then…
-
1
votes0
answers42
viewsFunction Problem IONIC 2 Typescript - Function runs only once
Goodnight! I have a problem with a function in Typescript(Ionic 2). The function does a search/filter from the contents of the tags. The user enters the number you want to search for and the…
-
1
votes0
answers26
viewsHow to create a service structure in vuejs using typescript and Generics?
Usually when I create a Vuejs + Typescript project I like to split the Services by creating methods that perform post requests, update, get and delete but I noticed that I was repeating a lot of…
-
1
votes0
answers461
viewsTurbo Table with Checkbox - Primeng
Hello, I am using Typescript, Angular 5, Primeng and Java for ERP system development. My front has a screen so that the user can choose the days of operation of the establishment. This screen has a…
-
1
votes1
answer99
viewsHandle HTTP Request with Item Array as response
Whoa, all right, guys? Maybe this question won’t help anyone, but I don’t know but what to do, you Stackoverflow guys are my hope. Next, on the page I’m mounting, will show all the plans that an…
-
1
votes1
answer140
viewsHow to get the percentage of similarity between strings?
What is the best way to compare the level, or percentage of likeness between two strings using Javascript or Typescript? Example: string1 = "Este grupo é muito util para crescer profissionalmente e…
-
1
votes1
answer64
viewsHow to use Generics with the props of a component?
I’m trying to create a component that will accept a generic type within the props. I’m trying to do it this way: interface Props<T> { items: T[]; } const componente:…
-
1
votes1
answer35
viewsWhat are the observables?
I would like you to explain to me what are the observables in the Angular. What are your differences for a?
-
1
votes1
answer165
viewsClass change to function
I want to turn the following class into a function: class Basic extends Component<Props, State> My question is: how do I move the props and state properties to the function?…
-
1
votes1
answer75
viewsGroup and add arrays with equal properties
x [{produtoId: 5, quantidade: 10}, {produtoId: 6, quantidade: 20}, {produtoId: 5, quantidade: 7}] y[{produtoId: 5, quantidade: 17}, {produtoId: 6, quantidade: 20}] I need to transform the X array…
-
1
votes1
answer45
viewsReact com Typescript
Hello, I am learning to make React applications with TS, and within my studies I came across a problem. I am exporting a component as follows const Button = styled.button` background-color:…
-
1
votes2
answers1393
viewsChild component calling another child component’s method
I have 3 Components, a Component Father, B Son and a C Son export class A Parent implements OnInit { constructor() { } } In Componen B I have a method to create user export class B Parent implements…
-
1
votes1
answer424
viewsProblem with routerLink at angle 6
I’m having the following mistake: Can't bind to 'routerLink' since it isn't a known property of 'a'. (" <h6 class="text-center"> Do not have an account yet? <a [ERROR…
-
1
votes1
answer652
viewsHow to "type" nested objects? (Typescript)
I have the following example object: const types: any = { car: { full: 'fullString', empty: 'emptyString' }, plane: 'myString', }; I’m trying to get a guy on types but the nested object (car), He…
-
1
votes2
answers847
viewsHow many days a week do you have in a month?
Hello, good night! I did a lot of research on the Internet and found nothing concerning this doubt! I would like to get how many days of the week there are within a month using javascript! Example:…
-
1
votes1
answer162
viewsProduction build problem when using Cryptojs
I have an application written in Angular 6 and there was a need to send a hash to the client. The contractor approved only the use of the library crypto-js. I did the implementation and everything…
-
1
votes1
answer742
viewsHow do I get the Header of a Sponse with Angular 2+?
How do I get a response header with Angular 2+? In my case, I’m using version 6. I would like to take this Authorization data to be stored in the Browser Localsession. I am using the following…
-
1
votes0
answers55
viewsdatepicker is not a Function in typescript
I want to implement datepicker in a typescript project. I tried to use initially install datepicker by npm but could not.... Initially imported <link rel="stylesheet"…
-
1
votes0
answers10
viewsI have a lib in React, using Rollup and installed @material-ui/icons , error when buildar... I already imported in rollup anyway did not solve
Error occurring while buildar I added in the rollup.config the material icons and core Dep... yet the error continued the same. anyone could help? please. a suggestion..…
-
1
votes1
answer65
viewsHow to access a property of the Event element in Javascript?
I think it’s a silly question, but by my beginner knowledge I’m hitting myself a little. I am building an application in ionic3, this uses typescript, however the plugin I am working uses pure…
-
1
votes1
answer89
viewsReorganize my array’s index
I have two cards in my app. The first card has index 0, the second card has index 1. There is a variable called listAtributos which has the following structure: 0: {indexvariacaoatributo: 0, id: 5,…
-
1
votes1
answer53
viewsHow to create a Union type from the elements of an array type in Typescript?
I have this code: const array = [1, 2, 3, 4, 5] interface data ... How do I get the contents of array and kind on date? As if it were so: interface data { numbers: 1 | 2 | 3 | 4 | 5 } PS: I nay I…
-
1
votes1
answer109
viewsForm control required depending on the selection of another angular form control
I have the following mat-checkbox: <mat-checkbox formControlName="formControlIdentificador" color="primary" class="correcaoClasseCheck" labelPosition="before"></mat-checkbox> <input…
-
1
votes0
answers100
viewsIonic+Firebase: Error: Uncaught (in Promise): [Object Object]
I am new to Ionic and I am facing a problem, I have this application that works with camera/ gallery, and I believe the error is in the file . ts is the code: save(animal) {…
-
1
votes1
answer34
viewsRepeat structure does not work when my object is copied without reference
I need to remove an attribute from my object (indexvariacaoatributo), but I need it to remain in the root object. This is my algorithm that receives in variable my object and then I remove the…
-
1
votes0
answers12
viewsMy empty default route is falling into the last set loading Lazy
I have the following standard route: const dashboardRoutes: Routes = [ { path: '', loadChildren: 'src/app/components/dashboard/bemvindo/bemvindo.module#BemVindoModule', canActivate: [AuthGuard] },…
-
1
votes0
answers30
viewsHttp request falling into catchError
I am trying to make http request inside httpInterceptor, but always falls in catcherror, is printed on the console the "crashed in err". intercept(req: HttpRequest<any>, next: HttpHandler):…
-
1
votes1
answer98
viewsIterate values of two requests in *ngFor
I am making two requests in the bank, one brings the orders grouped only for view on the front, the other brings all values, the last need to show the total of each request along with the view of…
-
1
votes0
answers42
viewsAngular continues my function before the dialog response
I have a function that calls a dialog if the SKU of a product is changed, but the function is being continued before the dialog result. Is there any way to wait for the result and only then continue…
-
1
votes1
answer435
viewsRecover Header from an angular Http Response
I need to recover the token that comes in Authorization and save in localstorage, but, I’m not getting. My login method within my service is: public login(email: string, password: string):…
-
1
votes1
answer143
viewsReactive validation at angular with formgroup
I’m trying to put an error message in the template, but I’m not getting to the Validator I created. This is the Validator: criarFormularioDeUsuario() { this.formularioLogin = this.fb.group({ email:…