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
answers113
viewsHow do I finish this function by clicking the finish button?
ion-button block (click)="getLoc()">start ion-button block (click)="getLoc()">Finish When I click on the "Start" button, this function grabs the current location every 10 seconds, as I do to…
-
1
votes1
answer167
views`Uncaught Referenceerror: floor is not defined` when trying to use floor and Random to choose an item from an array randomly
I have the following array: var cartasViradas=[ 'assets/img/1.png', 'assets/img/2.png', 'assets/img/3.png', 'assets/img/4.png', 'assets/img/5.png', 'assets/img/6.png', 'assets/img/7.png',…
-
1
votes3
answers913
viewsConditions with typescript
I’m trying to make a if in typescript but it simply gets ignored and never enters the condition. My typescript code: import { Component } from '@angular/core'; import { NavController, NavParams }…
-
1
votes1
answer1368
viewsReturn of Request - Angular4
I started the studies with angular4, and I’m trying to get the return json a simple request through a service. But when calling the method that makes the request, it presents me the following error…
-
1
votes1
answer446
viewsAngular-cli ng generate library does not work
I have a design in version 5 of the angular, which generates a library using the rollup and works properly. But I’m on the migration from version 5 to version 6 of the angular and wanted to use the…
-
1
votes0
answers218
viewshttp.post is not working
I am trying to submit a form to an API with the http post. Angular, but I’m not getting it: Code: save(auditoria):Observable <{}>{ let headers = new Headers(); headers.append('Content-Type',…
-
1
votes0
answers226
viewsSearch filter in Ionic
I made a filter to perform a search on Ionic 3. Here’s my Typescript code: filtrar() { //Filtra this.auto.storage.get("acesso").then(sessao =>{ var dados = {"token":123,"rg":sessao.rg, "data":…
-
1
votes2
answers71
viewsHow to write to mongodb via API
I have this API(Controller) [Produces("application/json")] [Route("api/[controller]")] public class TypesFieldsController : Controller { private IAddTypeFieldService addTypeFieldService; public…
-
1
votes2
answers121
viewssetTimeout doing lose value of variable?
I’ll summarize the code because mine’s too big, come on. I have a global variable of type Boolean that gets false, when entering an if it has to receive instead of false the true, but when entering…
-
1
votes0
answers83
viewsLoad component dynamically
How do I load a dynamic component depending on the module I’m seeing in Angular? I want to have a sidebar that will show content according to the module. For example: If you are looking at the Users…
-
1
votes0
answers22
viewsyoutubeplayer at the angle
Hello, I’m trying to implement a youtube player using angular 4, but I’m only able to create it using javascript code. Follow the code: var tag = document.createElement('script'); tag.src =…
-
1
votes0
answers73
viewsError [Cannot GET] when simulating my application with lite-server with typescript
I am error when simulating my application in typescript, the generated error is: Cannot GET / My tsconfig.json file from my application is simple, it only contains the following settings: {…
-
1
votes2
answers860
viewserror: Uncaught (in Promise): Error: Value must be an array in Multiple-Selection mode
Giving a compareWith, for the purpose of when I edit, the dropdowns can already be filled with the assigned values. By doing this, I catch this mistake: Uncaught (in Promise): Error: Value must be…
-
1
votes2
answers687
viewsAngular 2: My component does not work on index
I would like to interpret my component within my index.html, about.html, contact.html, and other pages. I created the component using Angular cli. My structure is as follows: The code inside my file…
-
1
votes1
answer366
viewsdoubts firebase with Ionic (ion-select)
I have an application, and I want to know how to insert information into the firebase database and then put this data inside a ion-select, my application uses a select of professions such as:…
-
1
votes1
answer459
viewsCentralize div content in Alertcontroller
I have the following code below let alert = this.alertCtrl.create({ message: '<div><img height="50" src="assets/imgs/success.png"></div><div>' + '<p>Cadastrado com…
-
1
votes1
answer2689
viewsWhat is the use of pipe() and map() functions in Angular 6?
I learned that I have to use these two functions when I’m working with HTTP requests, I learned that I have to use these two functions as a cake recipe, which you use and that’s it, I wanted to know…
-
1
votes1
answer742
viewsWhat is the difference between defining a model as an interface or as a class in IONIC?
I am a beginner in programming and my input language is Java. Studying some projects with Ionic, I found one that used an interface to define a model, for example: export interface Pessoa { nome:…
-
1
votes1
answer809
viewsUse global variable in Typescript with Nodejs
I am looking for a way to use global variable in typescript with Nodejs. For example in js I can do: //init.js global.foo = "foo"; //teste.js var foo = global.foo; Is there any way to do this in…
-
1
votes2
answers2064
viewsHow to perform a function on one component and affect another component - Angular 6
I would like to know how I can through one component affect another component at angular 6. These components are not father and son. They are distinct. <app-navegacao></app-navegacao>…
typescript javascript-events angular-6 angularjs-componentsasked 5 years, 9 months ago Leonardo Vinicius 335 -
1
votes1
answer497
viewsAdd a key/value to a typescript object
I have an array object that I want to add in position 0 a key and value in it. I tried something like: this.testeobj//meu objeto this.testeobj[0].push({oi: 'teste});…
-
1
votes0
answers209
viewsAngular Typeerror: _co.disable is not a Function
I would like to understand what is causing this error in my application. Follows the codes: desabilitar(elemento){ var radio = document.getElementById(elemento) as HTMLInputElement; radio.checked =…
-
1
votes1
answer651
viewsHow to compile a list with data from an Observable?
How to go through data from an Observable and insert into a list? I would like to compile a list of all the arrays within Observable that comes from Cloud Firestore, because I need a list of people…
-
1
votes3
answers908
viewsI have the following error in my Ionic project "Error: Uncaught (in Promise): Typeerror: Cannot read Property '0' of Undefined"
Hello my Ionic project is with the following error (Error: Uncaught (in Promise): Typeerror: Cannot read Property '0' of Undefined) follows an attached image of the problem. I would like some hint.…
-
1
votes1
answer99
viewsAuthenticate Angular with Steam
I am trying to authenticate my Angular app with Steam, but this generating this error in the log: Failed to load http://steamcommunity.com/openid/.well-known/openid-configuration: No…
-
1
votes3
answers4910
viewsConsuming an API with Angular
I’m trying to consume an API with Angular 5 but it returns me this error: " Error trying to diff '[object Object]'. Only arrays and iterables are allowed at DefaultIterableDiffer.diff". Response…
-
1
votes1
answer42
viewsQuestion about the map function
I have this object { "alunos": [ { "aluno": { "id": 1, "nome": "Genevieve Sipes", "status": "Ativo" }, "mensalidade": { "status": "Débito" } }, { "aluno": { "id": 2, "nome": "Greyson Herman",…
-
1
votes1
answer102
viewsInsert Command Line in typescript
I have a Mongodb installation and configuration script as required by the Company. Install_mongodb.BAT But I would like to automate this process including in the project in Typescript. I would like…
-
1
votes0
answers126
viewsExecute a class function based on a property
Please, I need to execute a function of a class among several classes that I only know is correct from the value of one of its properties. I create the classes for example: public tabelaSerie = new…
-
1
votes1
answer4034
viewsNodejs - Typeerror: Cannot read Property 'get' of Undefined
I am beginner in Nodejs and I came across this problem when I was exporting a module: "Typeerror: Cannot read Property 'get' of Undefined". I did not understand why the error occurred since the code…
-
1
votes0
answers185
viewsCreate fields with ngFor
I want to do something where I can every time I click the button to make new fields. What I’ve done is the following: <label for="">Contatos</label> <div *ngFor="let contato of…
-
1
votes0
answers34
viewsAccessing private property with typescript Decorator
In Typescript, is it possible to access a private property from the developer? An example of the code I’ve already made class A { @dec private _teste: string = 'teste' constructor(){} public get…
-
1
votes2
answers1678
viewsObservable, when to use?
Why and when should I use the Observable, what are its advantages and disadvantages and its difference compared to Promisses?
-
1
votes2
answers832
viewsDisable Initial validation of the Angular form
this.loginForm = formBuilder.group({ 'login': [null, Validators.required], 'senha': [null, Validators.required], 'estabelecimento': [null, Validators.required], }); Here I have my Validators…
-
1
votes1
answer1225
viewsPolymorphism with interface and abstract class
How do I make a method defined on the interface iDAO is passed on to be implemented by the class ProprietarioDAO, daughter of the abstract class absDAO, implementing iDAO? import { EntidadeDominio }…
-
1
votes2
answers138
viewsAutomatic cast with Typescript?
To the point: There is a way to cast automatically using an interface as a model in Ionic (Typescript + Angular 5)? If not, you can make Lint recognize that an object coming from the server is not…
-
1
votes1
answer104
viewsAngular 4 and Nodejs Express - Problem with CORS
Hello, I have two applications that run locally on different ports. One application is for API’s and another is the web part. When I send the form data to my typescript service, the data is arriving…
-
1
votes1
answer1326
viewsConcatenate a string with number in Typescript
I’m trying to add a 0 in the formatting of my date/month, but I’m not able to concatenate 0 with a string. I tried something like: var dd = dataAtual.getDate(); if (dd < 10) { dd = '0' + dd } I…
-
1
votes1
answer315
viewsCalculate and Decrease Array Values
I am trying to decrement and calculate values of an array unsuccessfully. The decrementation works to a certain extent, so it decreases different values than what is clicked on the checkbox and the…
-
1
votes1
answer2028
viewsFormgroup Angular
Hi, I’m new to angular and would like to know how I use more than one sternal validation with Formgroup. Currently my code is as follows... constructor(fb: FormBuilder, public router: Router){…
-
1
votes1
answer699
viewsDoubts of Angular masks
Hi, I’m new to Angular and I’m having trouble with my mask! I’m wearing the masks of "Angular-input-Mask"; I have a form that has a field 'CPF', the mask is applied perfectly. Visually when I type a…
-
1
votes0
answers356
viewsList the value of a Subscribe at Angular 2+
I have a component that connects with another sister component. From that, I made a service so that it is possible to make this communication. So far so good. The problem is that I can’t recover the…
-
1
votes2
answers102
viewsRegister a separate array in the database
I have a API in PHP and a app done with Ionic 3. I’m getting from the app a string this way "200,300,40" and the same thing "polimento,pintura,lavagem". I would like to know how to register each…
-
1
votes1
answer396
viewsCreate variable with an object property - Angular
I am trying to create a variable to set one of the properties of an object obtained by the get method. When I give console no subscribe I recover the value of the array, but I’m having difficulty…
-
1
votes2
answers9406
viewserror in using packages installed via npm with -g
installed npm install typescript -g and npm install @angular/cli -g and I don’t have access to tsc and ng. 'ng' não é reconhecido como um comando interno ou externo, um programa operável ou um…
-
1
votes2
answers1690
viewsError Datepipe Angular 6
I just upgraded my Angular 5 application to Angular 6. When saving a record in the Firebase database using mat-datepicker checking in the database I noticed that is correctly saving the date with…
-
1
votes1
answer103
viewsExit Confirmation Sweetalert 2 - Angular
Boa Tarde Personal, I recently met the Sweet Alert library. I’m trying to use it to leave a page, currently count only with a Function in Typescript. I would like to know how to transfer Sweet Alert…
-
1
votes0
answers133
viewsHow to access a typescript object?
I’m trying to access a database on firestore with this getAlldocuments: getAllDocuments(collection: string): Promise<any> { return new Promise((resolve, reject) => {…
-
1
votes1
answer73
viewsGet problem using google’s Angular API
I have an angled application that should search the Google API a long and lat. I created this method below to configure my call HTTP.GET(): ObterGeolocalizacao(): Observable<any> { const cep =…
-
1
votes1
answer3139
viewsAngular 7 - Input validation in a dynamic form
I made a form where the fields (input) appear according to the category to be created. The category is chosen when the user clicks on it, opening a new pro form tab. In the form, you have fields…