[Solved] Adding 2 components in my app.component.ts

do this: import {Component} from ‘angular2/core’; import {CoursesComponent} from ‘./courses.component’ import {AuthorsComponent} from ‘./authors.component’ @Component({ selector: ‘my-app’, template: ‘<h1>My first Angular2 App</h1><courses></courses> <authors></authors>’, directives: [CoursesComponent, AuthorsComponent], }) export class AppComponent { } btw, update your code based-on latest Angular version as this tutorial https://angular.io/docs/ts/latest/guide/learning-angular.html include your directives, pipe and other components to declarations array. src/app/app.module.ts … Read more

[Solved] Submit form as POST request and open new tab/window in Angular

Import the ReactiveFormsModule in your App.module.ts file Update: try it this way: <form #form method=”post” target=”_blank” action=”https://www.google.com/”> <input type=”hidden” value=”auth-token” /> <button mat-button color=”primary” type=”submit” (click)=”form.submit()”>Submit</button> <input type=”submit” value=”Submit” /> </form> 2 solved Submit form as POST request and open new tab/window in Angular

[Solved] Merge duplicate array of object key to single array

var myArray = [ {productId: 116605, productserialno: “324234”}, {productId: 106290, productserialno: “12121”}, {productId: 106290, productserialno: “12121”}, {productId: 106293, productserialno: “4324343”} ]; var grouped = myArray.reduce(function (obj, product) { obj[product.productId] = obj[product.productId] || []; obj[product.productId].push(product.productserialno); return obj; }, {}); var groups = Object.keys(grouped).map(function (key) { return {product: key, productserialno: grouped[key]}; }); var pre = document.createElement(“pre”); pre.innerHTML … Read more

[Solved] How to pass changed variable from Child component to Parent component without using @Output?

<random-directive [(ngModel)]=’name’></random-directive> In order to use ngModel you have to import in your module FormsModule from “@angular/forms” Here is an example plunker I made for you: https://plnkr.co/edit/AReq0QngbE9130Bd38Qq?p=preview You can’t use multiple variables with a single ngModel, but you can bind it to an object. If you define in your ts an object like this: public … Read more

[Solved] What is the required type argument?

What is the required type argument? When something needs a generic and isn’t provided. E.g. class Foo<T>{ data:T } class Bar extends Foo { } // Missing generic argument Fix Provide the generic argument e.g. class Foo<T>{ data:T } class Bar extends Foo<number> { } 2 solved What is the required type argument?

[Solved] Add list of selected items in select menu

Below code will make your dropdown multiple select and will display list of slected values from dropdown <body class=”ng-cloak” ng-controller=”DemoCtrl as ctrl”> Selected:<p ng-repeat=”item in ctrl.person.selected”> {{item.name}}</p> <form class=”form-horizontal”> <fieldset> <legend>ui-select inside a Bootstrap form</legend> <div class=”form-group”> <label class=”col-sm-3 control-label”>Default</label> <div class=”col-sm-6″> <ui-select ng-model=”ctrl.person.selected” theme=”bootstrap” multiple=”true”> <ui-select-match placeholder=”Select or search a person in the list…”>{{$item.name}}</ui-select-match> … Read more

[Solved] How to remove an item in an array in if else statement [closed]

There are many options how you can delete an element from the array. Look at the snippet below, there you can find examples with filter, slice and splice array methods for removing items. class TimeFilter { onHourChange(hours) { const noZeroMinutes = item => !(hours === 0 && item.value === 0); this.minuteOptions = [ { value: … Read more

[Solved] Angular2/4: What do [] and () means in angular html files?

You need learn the basics of AngularĀ 2 in order to understand these concepts. The [items]=”items” is data binding in AngularĀ 2 to pass data from parent component to virtual-scroll component where “items” is the property in parent component and [items] is the property of child component viz. virtual-scroll. The = passes the data from parent component … Read more

[Solved] How to download Angular 7?

If you navigate to: docs.angularjs.org You could spot the notice: This site and all of its contents are referring to AngularJS (version 1.x), if you are looking for the latest Angular, please visit angular.io To be short, AngularJS (1.x versions) is not Angular (even though Angular descends from AngularJS); Not sure you’re a web developer … Read more

[Solved] how deep can a url be in angular? [closed]

You have to repeat the complete path to the route you want to add in each module (meaning from root on). To solve your problem you would have to change your settings.routing.module.ts to import { NgModule } from ‘@angular/core’; import { Routes, RouterModule } from ‘@angular/router’; import { TeamsComponent } from ‘../teams.component’; import { SettingsComponent … Read more

[Solved] Drilldown in Area Charts

Drilldown for an area charts can be done like this: Set the drilldown for each point, and enable trackByArea (we enable this so that we can click in the middle of a series, and still be drilled down): series: [{ name: ‘Series 1’, trackByArea: true, data: [{y: 1, drilldown: ‘drilldownseries’}, {y: 2, drilldown: ‘drilldownseries’}, … … Read more