angular6

Can't resolve all parameters for Application Module: (?). at syntaxError (compiler.js:1021) site:stackoverflow.com

心已入冬 提交于 2019-12-11 06:34:56
问题 After downgrading my Angular project from version 7 to 6 and integrating Angular Universal with the help of @ngToolkit, I'm getting the following error message in the browser console: Can't resolve all parameters for Application Module: (?). at syntaxError (compiler.js:1021) I downgraded the project by simply overwriting the dependencies like described here. As already described the error only occurs in the browser console, while to compilation of the project is completing successfully. 回答1:

Trigger click on specific item under nested loop Angular ngFor

一笑奈何 提交于 2019-12-11 06:24:36
问题 How to target on the specif item under the nested loop <ul #parents *ngFor="let parent of parents"> <li #child *ngFor="let child of parents.childGroup"> {{child.name}} </li> <ul> Ts File Asper my code my target is parents[5].child[0] , but its working as child parents[0].child[0] @ViewChildren('parents') parents : QueryList<ElementRef> @ViewChildren('child') child: QueryList<ElementRef> this.parents.forEach((item, index) => { if (index === 5 ) { (this.child.find( (item , index) => index === 0

How to refactor a subscribe inside a subscribe in rxjs

左心房为你撑大大i 提交于 2019-12-11 06:20:00
问题 For example: this.saveSubscription$ = this.ds.onSave$.subscribe(x => this.sb.updateMachineTool(this.viewEditModel.viewEditModel).subscribe(x = { console.log('alert results', x) }) ) this.ds.onSave$ is a subject that triggers when a save button on a different component is clicked. this.sb.updateMachineTool is an httpClient post that updates a specific tool should I be using some type of map so i'm not subscribing to both areas? How can I refactor this code? 回答1: To Refactor your code You can

Extending native HTML element in Angular 6

﹥>﹥吖頭↗ 提交于 2019-12-11 06:08:24
问题 I have recently created a native web component which is working well in all browsers. I moved this web component into an Angular 6 application and all works as expected. I then tried to extend a native HTML element which again worked perfectly except when I brought it into my Angular 6 application. Using the examples from Mozilla I will try and illustrate my issue. Using the following trying to extend a native 'p' element: // Create a class for the element class WordCount extends

Angular How to toggle the color of a button wich is inside a button group if it is clicked?

走远了吗. 提交于 2019-12-11 06:02:05
问题 I have a group of buttons in an angular 6 component: <div class="container"> <div class="row"> <div class="clearfix text-center" [hidden]="!searchTerm"> <span class="inline">Filter results by :</span> <div class="float-right"> <button type="submit" class="btn btn-primary" (click)="performSearch(searchTerm)">All</button> <button type="submit" class="btn btn-secondary" (click)="domainesFilter(searchTerm)">Domaines</button> <button type="submit" class="btn btn-secondary" (click)="sectionsFilter

How to add validation in template driven form from component in angular 6

元气小坏坏 提交于 2019-12-11 05:59:28
问题 In angular 6, We have two approaches to create the form. Model-driven Template-driven In the model-driven approach, we defined the validators via code in the component. And In the template-driven approach, we define the validators via directives and HTML5 attributes in our template itself. Is there any approach, In the template-driven form, We can define the validation from component code. I need to define and change the validation of a text box from component code on some input test change.

Pass data from one component to another in angular 6

本小妞迷上赌 提交于 2019-12-11 05:58:28
问题 I'm new to angular i tried to send some formdata from one component to another by using service but it faces some issue ie , it shows error message as error TS2339: Property 'subscribe' does not exist on type '(data: any) => void'. This is the component that i had my data import { Component, OnInit } from '@angular/core'; import { JarwisService } from '../../Services/jarwis.service'; import { DataTransferService } from '../../dt-broker/dt-core/services/data-transfer.service'; import { Router

Angular5: batch calls to get data for a filed in a json array

﹥>﹥吖頭↗ 提交于 2019-12-11 05:34:17
问题 I have an array with json data in the below format staff = [ { "id" : 1, "name" : "Robert" }, { "id" : 2, "name" : "Peter" } ] I am trying to get the designation of these people. There is an API which accepts group of ids. I am trying to get designations in batches of 30. i.e send first 30 objects and get their designations and go on.. I tried keeping a for loop and pass 30 objects but unsuccessful. Designation API gives data in the below format. [ { "staffId": "26", "designation": "PRA" }, {

How to wait return statement if subscriber not completed in angular 2/4/6

老子叫甜甜 提交于 2019-12-11 05:30:39
问题 Currently I am working on the Angular6 project, and I have auth-http-interceptor. The problem in this file is that I want to get refresh token/acquire token from angular4-adal service every time, and for that, I have to subscribe the acquire token which will give the token and then want to assign that token in authReq object. But my intercept method's return type is Observable. Then how could I wait for subscribing the acquire token and then return next.handle(authReq). I have tried to write