Issue I have two component A and B, where component A contains a button. I wish when user click on this button, fire a function on component B <A></A> <router-outlet></router-outlet> And the component B is rendered using routing.I am considering
Continue readingTag: angular2-services
Angular 2 get routeParams in a service
Issue I want to shift the logic from component to service. But I found out that I can’t get the routeParams in a service. My component looks like import { Component, OnInit } from ‘@angular/core’; import { ActivatedRoute, Params }
Continue readingHow do I create a singleton service in Angular 2?
Issue I’ve read that injecting when bootstrapping should have all children share the same instance, but my main and header components (main app includes header component and router-outlet) are each getting a separate instance of my services. I have a
Continue readingUsing angular 2 ajax in ionic 2
Issue I am running an angular 2 application in ionic 2 and I am trying to get JSON data from a server. What is the process for making a call to the server and receive JSON so my application can
Continue readingCan't Bind Property in Angular 4
Issue Why is there a problem in binding a property on the same component? I already added Input() but still doesn’t work. Do i need to put Input() even though it is on the same component when binding? //output.component.ts import
Continue readingNativeScript: Difference between a class and a service?
Issue I’m trying to get into Nativescript + Angular2, and I read the following in the tutorial: We’ll build this functionality as an Angular service, which is Angular’s mechanism for reusable classes that operate on data. What they then do
Continue readingGetting undefined error when trying to add array
Issue When user click on button, I have to add the value inside sample array. Below i have posted the code: sample_apps.json: { “user”: { “userId”: “maxwell”, “sample”: [ ] } } app.component.ts: import { Component } from “@angular/core”; import
Continue readingHow to select/init first value in html select option after data loads thru Angular 2 observable?
Issue I have an html select with options that looks like this: <select [(ngModel)]=”role” (ngModelChange)=”roleChanged($event)”> <option *ngFor=”#role of roles” [ngValue]=”role”>{{role.Name}}</option> </select> roles[] gets assigned in a subscribe of an observable from my service. Everything is working fine except the select
Continue readingObjectUnsubscribedError: object unsubscribed error when I am using ngx-progress in angular 2
Issue I am using ngx-progressbar bar in Angular 2 application. When app loading first it is working fine. second time it is showing error. I referred few article like medium.com for subscribe object. I did’t get clearly. I need to
Continue readingUsing an Angular 2 http.post without subscribing? Or am I thinking of it wrong?
Issue Is there a way to just tell the server to update data without subscribing? Skipping a return statement and a subscription seems to render the http call inert. In my case, my DB guy created a bunch of stored
Continue readingHow to subscribe to event emitter once?
Issue // Part of service public someEvent: EventEmitter<number> = new EventEmitter(); …. // Component @Component({ selector: ‘some-component’, template: `…` }) export class SomeComponent { constructor(public service: Service) { this.service.someEvent.subscribe((x) => { // Do something }); } } SomeComponent is displayed
Continue readingIs it possible to use HostListener in a Service? Or how to use DOM events in an Angular service?
Issue I want to create a service which detects all keyboard input, translates the key strokes into actions based on a configurable mapping, and exposes observables which various elements can bind to to react to specific key presses. The following
Continue readingAngular2 multiple components using one REST call
Issue I am part of a Angular2 application (we use beta3) and the issue is the following: Usually we have a component that uses some service that uses some rest call and the component displays the data. Great. However we
Continue readingAngular2 scope's and components
Issue All, This is what I have: user-list.component.ts export class UserListComponent { public userSerivce: UserService; public deleteUser(id) { this.userSerivce.delete(id); } } user-list.component.html <div> <some-reusable[deleteFunc]=”delete” > </some-reusable><!– this will bind “delete” on the user- list.component, to “deleteFunc” on SomeReusableComponent–> </div> some-reusable.component.ts
Continue readingAngularjs One component multiple views(Html+css)
Issue I need to figure out how I can have different views(html+css) for a component. A lot of people say that it’s better to have multiple components for each for each of those views and then use a service to
Continue readingViewChild – Angular 2 Javascript
Issue How can I use ViewChild in Angular 2 Javascript? I have referred angular.io docs and I have tried with the following code and it is not working. Can anyone help me? Thanks in advance. main.html <router-outlet></router-outlet> app.component.js (function (app)
Continue readingHow to inject the same service in 2 components which interact dynamically with it in Angular2
Issue I have an application which includes the action of changing the image of background by choosing an image from a collection of examples, the idea is to write a service whiche parse the json list links of images and
Continue readingAngular2 :Passing an object betwen 2 component via service
Issue i’m working on an angular 2 beta9 app , i’m trying to make to components deals with each other , i have a “start ” component which is a bloc a radio box button , where the selected item
Continue readingAngular 2 Inject complex service to service
Issue I have three services and one component: root.service abstarct-child.service extend-child.service app.component The root.service injects by using dependency injection the abstarct-child.service, like so: import {Injectable} from ‘angular2/core’; import {AbstractChildService} from ‘./abstarct-child.service’; @Injectable() export class RootService { constructor(private _abstractChildService: AbstractChildService) {}
Continue readingangular2 – passing data object between components
Issue Looking for some help, if possible. I have a data object located in one component, received from a REST call. It contains user details that I would like to share across components, but I am having trouble. What is
Continue readingAngular2 :Sending data from a component to a component via service
Issue i’m catching a data from a component and i’m trying to send it to another component via a service Component1 (Start) : radio box View <md-radio-button *ngIf=”item.id===1″ value=”{{item.value}}” class=”{{item.class}}” checked=”{{item.checked}}” (click)=”onSelectType1(item)”> //here i’m catching the value {{item.label}} </md-radio-button> ts
Continue readingComponent as Injectable?
Issue I am trying to build my own Modal component, that I would be able to reuse throughout my Angular2 Apps. I am considering different approaches, and I am wondering if it is possible to create @Component that also serves
Continue readingAngular RC 1 – Find out when a subscribe succeeds
Issue Im running into some issues since migrating to RC1 one of which is within one of my components, I have a service which grabs some json from a laravel api and subscribes to it then within the component I
Continue readingTypescript Error TS2339: Property 'project' does not exist on type '{}'
Issue Hitting this old issue in Angular 2 RC1.. Very frustrating stuff.. has anyone go any idea what I can do here to make this compile.. The line thats causing the error is : this.project = res.project; Here is my
Continue readingAngular2. Provider/Service function is undefined when called form component
Issue I’m working on a Ionic 2 project. This is the provider/service in which I make a request to my local API… import {Injectable} from ‘angular2/core’; import {Http} from ‘angular2/http’; import ‘rxjs/add/operator/map’; @Injectable() export class ServiceTest { // data: any
Continue readingAPI post call conflict Angular2 .map defaultOptions.merge is not a function in
Issue I have tried to call the API by post method but I got this error: this._defaultOptions.merge is not a function … I was checking a few answer and I tried to import and doesn’t work import ‘rxjs/add/operator/map’; import ‘rxjs/rx’;
Continue readingDelay navigating to next page
Issue My angular site works great, but when you click into a project it loads the page, right away and sometimes there is a flash while the images are pulled from the API, id like a 1 second delay, or
Continue readingAngular 2 RC 2 Using Mobile Gestures (Swipe, Pinch, Rotate)
Issue Can anyone please guide how to use mobile gestures in Angular 2 RC2. May be something like: <div (swipeLeft)=”OnSwipeLeft()”></div> From the API can see HAMMER_GESTURE_CONFIG HammerGestureConfig under @angular/platform-browser But not sure how to use it. In some posts in
Continue readingHow do you test Angular 2 directive that calls a service?
Issue I used angular-cli to create a simple app to illustrate my problem. You can see all the code here: https://github.com/wholladay/tracking The directive calls a service whenever the containing element is clicked on. Therefore, I’d like to mock the service
Continue readingAngular2 Http get
Issue I am trying to be pull data from API using Angular2, and bind it to view. After request been done, my component only gets array object [object Object],[object Object],[object Object]. Can I get any help on extracting the object
Continue readingchild component EventEmitter not working
Issue I have CreateProjectComponent which is child component I need to close a div in Parent when closeModal is clicked The template (html): <div (click)=”closeModal(true)”></div> The component.ts @Component({ moduleId: module.id, selector: “th-create-project”, templateUrl: “create-project.component.html”, styleUrls: [“create-project.scss”], directives: [ ThAutocomplete, MD_CARD_DIRECTIVES,
Continue readingBootstrapping app in Angular 2 RC 5
Issue As I understood now I should use modules for bootstrapping. But now I couldn’t understand how should I provide custom providers? Example from RC 4: bootstrap( …. { provide : Router, useClass: SomeClass }, { provide : API_URL, useValue:
Continue readingAngular2 datePipe returning formatted date but with an additional month
Issue This is my formatter function: public formatDate(date: Date): string { var datePipe = new DatePipe(); if (date) { return datePipe.transform(date, ‘yMd’); } else { return “–“; } }; When I use it let dateFooBar = new Date(2016, 5, 10);
Continue readingWhy doesn't Angular2 auto detect directives and providers used in a component definition?
Issue For custom directives used inside the template, I guess it might make sense for Angular to not know the new html elements/attributes until we tell it in the “directive” property of the Component function. However, what I don’t understand
Continue readingAngular 2 Lazy Loading and Application-wide singletons – Custom Http Class Not working
Issue I am trying to use the Angular 2 Router Lazy Loading to reduce initial load time. In my app I have customized the original Http service of the Angular to display a loader whenever any http request is initiated
Continue readingAngular 2 RC 5 Bootstrap custom HTTP class TypeError: Cannot read property 'toString' of null
Issue In Angular 2 RC 4 I have a class HttpLoading which extends the original Http service of Angular 2. With RC 4 I was able to use that in bootstrap without any issue using the below code: bootstrap(AppComponent, [
Continue readingHow to deal with multiple null or undefined values when any object or field can be null? like this <p>{{object.object2.object3.field1}}</p>
Issue <p>{{object.object2.object3.field1}}</p> I have many <p> filled with objects that have an object which have an object that might have field and in any case object or object2 or object3 or field can be null or undefined. How to deal
Continue readingAngular 2 RC 5 Bootstrap custom HTTP class
Issue In Angular 2 RC 4 I have a class HttpLoading which extends the original Http of Angular2 I was able to use that in bootstrap without any issue using the below code: bootstrap(AppComponent, [ HTTP_PROVIDERS, provide(RequestOptions, { useClass: DefaultRequestOptions
Continue readingExecute particular component after click on md dialog button
Issue I have 8 graph images on left side panel of the page. When I’m dragging these images and dropping on right side panel then i’m displaying MD Dialog box. In md dialog box i’m displaying list in drop down
Continue readingBehaviorSubject in Angular2 is not set value second time?
Issue My code is like login.component.ts loginSucess () { this.MenuService.setUserName(userauthresponce.username); } MenuService.ts private usernameSource = new BehaviorSubject<any>(0); setUserName (username) { this.usernameSource.next(username); } getUserName () { return this.usernameSource.asObservable(); } other.component.ts constructor(MenuService:MenuService) { this.MenuService.getUserName().subscribe(responce => { console.log(‘username’, responce); this.username = responce; });
Continue readingHow to watch from directive on a simple variable changes inside a service?
Issue I have a simple service with data variable: import { Injectable } from ‘@angular/core’; @Injectable() export class MyService { private _data:number; get data(): number { return this._data; } set data(value: number) { this._data = value; } } Now from
Continue readingHow to capture an arbitrary component's state from an Angular2 service
Issue Context: I’m implementing a BI telemetry/logging library as an Angular2 service. The goal is to get a PageView event to fire every time I visit a new “page” within my app. To do that, I’m currently putting a subscribe
Continue readingAngular 2 – Lifecycle event after Constructor Called
Issue I am trying to do a simple work with Angular 2. I want to catch event after component’s constructor’s call is finished. I am making a network call in the constructor like this- import { Component } from ‘@angular/core’;
Continue readingHow can i emit a string in service and get in component
Issue I want to emit a string when the util.service.ts handled some errors, so that i can get this message in app.component.ts and show it, but i can not subscribe the emitter. this is my code, but it do not
Continue readingGet angular 2 service inside a custom class instantiated by me
Issue Im building an angular 2 app, and i need a way to get a reference to a service/class that is injected/instantiated by angular framework. I have a generic class…lets call it Custom class, that i use throughout the site.
Continue readingAngular 2 Http Error
Issue I’m new in Angular 2 and I am very stuck on HTTP. The application runs but when I try get my InMemoryDbService it fails. The error is: EXCEPTION: Uncaught (in promise): TypeError: Cannot read property ‘0’ of undefined but
Continue readingMultiple occurrences of the same custom directive Angular2
Issue I’m currently building an Angular application, where I was trying to make the code highly reusable with the help of directives(as components). <div class=”container container-fluid” > <div class=”row”> <table class=”table table-responsive table-hover”> <thead class=”thead-inverse”> <tr> <th *ngFor=”let column of
Continue readingHow Communication takes between two sibling component in Angular 2 (plus)
Issue I am working on angular 2. I found that the communication between the two sibling components or from child to parent is difficult. Even it was not mentioned in the angular 2 documentation Would you please provide some information
Continue readingHow to send POST in angular5 with multiple params?
Issue I’m working in angular5 simple project (front end) and back end(spring boot) , i want to send a post request to the api rest with 2 parameters idPerson , and idProject , so the api rest can affect the
Continue readingHow to unsubcribe a timer service call using takeUntil
Issue I am calling a service regularly after a certain interval of time. I get two numbers as result in the service response,I want to compare those numbers and if they are equal I want to end the service calls.
Continue readingANGULAR 2 – Component Shared Data Service
Issue this has really been wreaking my head. I have a nice little app with social login setup using Firebase and Angular 2. Everything should be realtime. Basically when a user logs in via Facebook I want their personal info
Continue readingAlerts and navbar module/component/service: how to decouple views?
Issue So I used to have this function in app.component.ts: addNewAlert() { this.appService.navbarPadding += 81; this.alertsService.alerts.push({ type: ‘info’, msg: ‘INFO’ }); } But it doesn’t belong there. Does it belong on the service? – Probably not, the service is meant
Continue readingMaking dynamic Components fit: margin/padding changes: better way?
Issue I want alerts to appear within/above my static bootstrap v4 navbar. So I’ve got this simple service: import { Injectable } from ‘@angular/core’; import { Subject } from ‘rxjs’; @Injectable() export class AppService { private _navbarPadding: number = 50;
Continue readingHow to pass service returned data as an input of child component? Angular 2
Issue I am trying to pass data that I am getting from my service call to the input of my child component but its always undefined or null. I have figured out the reason but don’t know how to solve.
Continue readingAngular 2 template wide javascript
Issue I built an Angular 2 application that has some template javascript (for example opening / making the menu smaller, closes content panels). I was wondering what would be the best way to store this type of “template wide” javascript?
Continue readingwhy is the router not updating the data correctly in html template in angular 2?
Issue I have the following resolver: @Injectable() export class DashboardDataResolver implements Resolve<division> { constructor( private service: dashboardService, private router: Router ) {} resolve( route: ActivatedRouteSnapshot, state: RouterStateSnapshot ): Observable<division> | Promise<division> | any { console.log(route.params); let id = route.params[ ‘id’
Continue readingcalling success, error callbacks using subscribe in angular2?
Issue Giving responce.json () is not function for my case component.ts this.AuthService.loginAuth(this.data).subscribe(function(response) { console.log(“Success Response” + response) }, function(error) { console.log(“Error happened” + error) }, function() { console.log(“the subscription is completed”) }); AuthService.ts loginAuth(data): Observable<any> { return this.request(‘POST’, ‘http://192.168.2.122/bapi/public/api/auth/login’, data,{
Continue readingAngular 2 sibling components 2 way binding
Issue I am having 2 sibling components displayed at the same time to the user. One of them is a QuestionList which takes an array of questions from service and display list of questions. Once you click on a particular
Continue readingAngula2 bind template variable to service
Issue I am trying to simply bind a variable in a template in Angular2 to a variable of a service. The service should load the data via http and then update the view in the template accordingly again (I assume
Continue readingAngular 2: ngFor with map, use pipe or rx?
Issue I have a scenario where the server returns object maps rather than arrays. I need to display the data in an *ngFor. I have read excellent threads on this such as this one which seem to favour using a
Continue readingdot (eg. reponse.title) property is not working on response object got from http service in angular 2
Issue I received response object from http service in angular 2 and if i try to console response.prop, it is not working and it is showing following error: D:/ABC/angular-training/angular_cli/src/app/shared/footer/footer.component.ts (16,28): Property ‘prop’ does not exist on type ‘{}’.) But when
Continue readingCalling Angular2SocialLoginModule function calls not supported
Issue I am new to angular js2. Currently I am working with a web application, which uses angular2 for front-end. In this application I have used angular2-social-login for authentication purpose. But when I run the npm start I got the
Continue readingShould I use Angular 2 Components or Services
Issue I have written an angular 2 component: @Component({ templateUrl: ‘, selector: ‘dino’, templateUrl: ‘./dino.component.html’, styleUrls: [‘./dino.component.css’] }) export class DinoComponent { … } It is an image viewer contained in a modal window. I want to share this component
Continue readingAngular2 location.back() page reloads?
Issue I am in need to give a Go-Back button for this I am using location services as: import {Location} from ‘@angular/common’; backclicked(): void { console.log(“back clicked.”); this.location.back(); } <a id=”redirect-link” (click)=”backclicked();” style=”padding:8px 15px;” > Issue is this that location.back()
Continue readingGet Updated value of an bool data
Issue I am using angular 2. i made a service and i want to perform a simple task just like , i made object of service at in two components. at where component1 change the bool value to true at
Continue readingIonic 2 view rendering (and erroring) before data has chance to load
Issue I’m writing my first Ionic 2 app and am struggling to get my head around something that I didn’t have to worry about in Ionic 1. I have a list view which lists items fetched from an API. This
Continue readingHow to get response of a service in an array for use, in angular 2
Issue I had declare an array.at .ts file: responsearray:any=[]; Inside constructor: constructor(private _dataService: UserService, private _ngZone: NgZone) { this.responsearray = this.getmarkers(id); this.moveMarker(this.responsearray); } I want to pass updated value of response array in movemarker function and it also updated inside
Continue readingPassing value between two angular 2 component typescript files
Issue I have two components that are not parent Components and those are child components but I need to pass data from component A to component B. example: component A.ts has an array of data example : my data [
Continue readingBinding data to template after making a call to service using http.get in angular2
Issue Service let options = new RequestOptions({ headers: this.headers }); let body = JSON.stringify(this.params); return this.http.post(this.url,body, options) .map((res: Response) => res.json() as Observable<Proc>) .catch((error: any) => Observable.throw(error.json().error)) Component this.procservices.GetProcData(this.selectedServer,”test”,”test2″) .subscribe(res => { this.inventoryList = res as Proc[]; console.log(this.inventoryList); }, error
Continue readingAngular 2 subscribing to a service which is subscribed to another async function
Issue I am trying to develop an Angular application where there is a situation I am calling a service that is subscribed to HTTP service. I have written an alert prompt service which internally calls the HTTP service when “ok”
Continue readingmultiple ngx pagination error-angular 2
Issue I am using angular 2 for one of my projects and i am using ngx-pagination for paginating tables.The structure of my page is like this parent->child1=table1 child2-table-2 child-table-3 child4-table-4 each child calls its own rest request and fills the
Continue readingAngular 2 :Uncaught (in promise): RangeError: Maximum call stack size exceeded RangeError: Maximum call stack size exceeded
Issue I just begin working with angular 2. so I try to display categories from data base using web service. this is my forum.service.ts file public getCategories(){ return this.http.get(‘http://localhost/ForumLaraAngular/public/api/forum’).map((res: Response) => res.json()); } forum.component.ts: categories:any; constructor(private forumService:ForumService) { } ngOnInit():
Continue readingBinding a dynamic object to Html using Angular2
Issue this.procFilterResults: any[]; this.procservices.GetProcData(this.selectedServer, this.selectedProjectName, this.selectedProc, this.procInput,_inputs ) .subscribe(res => { this.procFilterResults = JSON.parse(res); this.Keys=Object.keys(this.procFilterResults[0]); console.log(this.procFilterResults); }, error => this.errorMessage = <any>error); <table class=”table table-bordered”> <thead> <th *ngFor=”let key of Keys”> {{key}} </th> </thead> <tbody> <tr *ngFor= ‘let res of
Continue readingAngular 2 bootstrap process
Issue I want to make an AJAX request before calling the bootstrap method in Angular 2 to bootstrap the application on page load. Are there any hooks I can listen for to do this using Angular? I know I could
Continue readingAngular 2 load data before render template
Issue I have the following html code: <tbody ng-repeat=”caterory in data”> <tr> <td [colSpan]=”segment”>{{ caterory.name }}</td> </tr> <tr ng-repeat=”room in caterory.rooms”> <td>{{room.room_no}}</td> <td [colSpan]=”schedule.dayDiff” ng-repeat=”schedule in room.reservations”>{{schedule.firstName}}</td> </tr> </tbody> When I run I’m getting the following error: TypeError: Cannot read
Continue readingrouter-outlet inside router-outlet calling independent routes dynamically
Issue I have angular 2 project that has many modules in it. I load each of the module using lazy loading technique as follows { path: ‘home’, loadChildren: ‘./dashboard/dashboard.module#DashboardModule’ }, Now I have a situation where I load a module
Continue readingangular post method parameters
Issue I am currently using angular 4 to build my web application.In that i am getting the data via rest calls to webservices,when i post data i want to know if i can change the body presentation (second param in
Continue readingSingleton service – different values for its attributes in multiple components
Issue I want to have a shared state/data between two components (topic component and topic-detail component). I decided to use a singleton injectable service (topic service) for this. The behaviour is as follows: If the user clicks on a row
Continue readingAngular 2 Media Queries
Issue I want to know that does Angular 2 provides a way to determine the client’s device (large screen, medium or smalls screen) or may be screen width on the basic of which some contents could be shown or hidden
Continue readingExpressionChangedAfterItHasBeenCheckedError` error angular 4
Issue i am trying to work on a project which has multiple components. Example app is here. I am in a situation where i am getting the error in the development mode as follows I know why this error is
Continue readingFilter is not a function in custom pipe angular 2
Issue I’m beginner to Angular 2. I was trying to create the custom pipe for search operation in angular 2. While trying to filter the objects of data by using the filter function I was getting as like my data
Continue readingBinding Component's variable to service
Issue I need to take a reference of a variable that is in a service. The variable in the service also can be changed by another function that is in another component. It is hard to explain so let me
Continue readingExpressjs to upload an image using multer saves an image in a weird format
Issue I am trying to build an API which will take in image so used multer for that purpose, I am getting a success for uploading an image but it saves in some weird format not the actual format I
Continue readingExpressjs to upload an image using multer saves an image in a weird format
Issue I am trying to build an API which will take in image so used multer for that purpose, I am getting a success for uploading an image but it saves in some weird format not the actual format I
Continue readingAngular2 [style.width] binding high CPU usage
Issue I’m currently integrating a top-bar progress indicator for Angular (6.0). I tried multiple npm packages, but all suffer from a high CPU usage as soon as I start the progress loader. The Chrome Task Manager reports 50-80% CPU usage.
Continue readingAngular 2 not loading in IE 11 even after making all the changes mentioned in previous stackflow questions as well as GitHub and other websites
Issue We are working on Angular 2 and are able to load everything on all web browsers except IE 11 (and below). The complete typescript itself is not getting loaded and there is nothing on the console to analyze. We
Continue readingAngular 4 http batch requests
Issue To optimize my API calls, I would like to make batch requests using this module https://github.com/jonsamwell/ngx-http-batcher#examples. As per the example, the configuration is set in AppModule. export function httpBatchConfigurationFactory() { return new HttpBatchConfigurationCollection([ new HttpBatchConfiguration({ rootEndpointUrl: “https://api.myservice.com”, batchEndpointUrl: “https://api.myservice.com/$batch”
Continue readingRendering <style> inside Component with Renderer (Angular 7)
Issue I have issue with rendering inside component. I would like to emit data from another component and send to another component, data was emitted, but the problem is when I create the element with Renderer2, sometimes it’s working, but
Continue readingHow can create a dynamic menu in angular 2?
Issue I need to create a dynamic menu after user logged in successfully and redirected to home page using Angular 2. Exactly like in the first similar question except I cannot hardcore the menu items. Angular2: Using routes, how to
Continue readingHow to In memory web api for two different jsons
Issue I am using In memory web api for two json services(DB) 1) import {InMemoryDbService} from ‘angular-in-memory-web-api’; export class InMemoryDataService implements InMemoryDbService { createDb() { let heroes = [ {id: 11, name: ‘Mr. Nice’}, {id: 12, name: ‘Narco’}, {id: 13,
Continue readingReading JSON file in angular 2 application
Issue I have a file data.json which I want to import in my angular 2 application. I am getting file with HTML input tag. <input type=”file” (change)=”onImport($event)”/> in my typescript file I want to read this data.json file and store the content
Continue readingAngular Http – toPromise or subscribe
Issue I have watch a few courses on Angular and have found there are different ways to manage data from an Http request. Using Observables, .map(), .subscribe() Using Promises, .toPromise(), .then(), .catch() I have used toPromise() in my application as
Continue readingHow to check the length of an Observable array
Issue In my Angular 2 component I have an Observable array list$: Observable<any[]>; In my Template I have <div *ngIf=”list$.length==0″>No records found.</div> <div *ngIf=”list$.length>0″> <ul> <li *ngFor=”let item of list$ | async”>item.name</li> </ul> </div> But list$.length doesn’t work with in
Continue readingHow to implement Azure multi tenant app access in angular 2
Issue I’m new to angular 2 . I am working on Multi Tenant application in angular 2. I have done Multi Tenant application in ASP.netMVC.But in angular2 i’m not getting any idea. I have done single tenant authentication in Angular
Continue readingHow to implement Azure multi tenant app access in angular 2
Issue I’m new to angular 2 . I am working on Multi Tenant application in angular 2. I have done Multi Tenant application in ASP.netMVC.But in angular2 i’m not getting any idea. I have done single tenant authentication in Angular
Continue readingOutput individual array results, not using ngFor
Issue How do you get one result from an observable.. I can easily use ngFor to loop over lots of results but if i want to output one result in a certain part of the page then another result how
Continue readingImporting Angular2 Components with Absolute URLs
Issue Following is the directory structure of a example project: app |-components | |-hero-detail | | |-hero-detail.component.ts (HeroDetailComponent) |-services | |-hero.service.ts (HeroService) I want to use HeroService in HeroDetailComponent. Currently I am importing HeroService into HeroDetailComponent using the following statement:
Continue readingObject mapping with a defined schema Angular 2/4
Issue I am in a situation where i have to design an object mapper with a defined schema ie I will get a response with an array of objects which is the schema for object mapping like this. [ {
Continue readingHow should I pass data from my service to snack bar component?
Issue I have a snackbar component which I have created like this! import {Component, ViewEncapsulation, OnInit, OnDestroy} from ‘@angular/core’; import { MatSnackBar, MatSnackBarConfig, MatSnackBarHorizontalPosition, MatSnackBarVerticalPosition, } from ‘@angular/material’; import { Subscription } from ‘rxjs’; import { AuthenticationService } from “../../services/authentication.service”;
Continue readingHow to remove duplicate object from an array in angular 6
Issue I am trying to remove duplicate value objects in an array but not working… I think duplicate function is working but not reflecting in li list. Can you find out where I have to change? My service file: addComp(Names,c){
Continue reading