Questions tagged [angular2-changedetection]

473 questions
0
votes
1 answer

Change detection for stream in Angular 2?

I am not able to assign a variable while a stream is being read in a component. import { Component, OnInit } from '@angular/core'; var fs: any = require('fs'); @Component({ selector: 'stream-cmp', templateUrl: 'app/view/stream.html', styleUrls:…
0
votes
0 answers

Masking a text field in Angular 2

I want to apply masking to fields like phone number, credit card and SSN e.t.c in Angular 2. I can't find any solution. Masking of a field should occur when the correct number of digits entered, for example, if the user enters 10 digits for a phone…
0
votes
0 answers

Destroying dynamically created component throws change detection error

I'm attempting to destroy a dynamically created component which is inserted into a modal window. The component code is import {Component, Input, Output, OnInit, EventEmitter, OnDestroy} from '@angular/core'; import {NgSwitch, NgSwitchCase,…
0
votes
1 answer

angular 2 check if model change on component

First, my code is working. This question is about if I am doing the proper thing and if I am using the power of angular 2. I come from angular 1 and still learning angular 2 core concepts. Let's start: Given an angular 2 app (RC.4) I have a…
Vicens Fayos
  • 740
  • 1
  • 5
  • 18
0
votes
1 answer

How to push and update deep nested values in angular2 and maintain ui state

i have a deeply nested array as follow mainarray[]:{ array1[]:{sub1_array1[]:{},sub2_array1:{}}, array2[] ... // and so on } since i am retriving main array on init how can i push sub2_array1 updated values? but since on change view renders and ui…
noobProgrammer
  • 2,884
  • 3
  • 17
  • 20
0
votes
1 answer

Angular2 observable change detection template update

For performance reasons, I am trying to set up manual change detection on my components. The structure of the app: App -> Book(s) -> Page(s) I subscribe to an observable in the AppComponent, I then run the "markForCheck" method of the…
Kris
  • 824
  • 2
  • 12
  • 28
0
votes
1 answer

listening to a model in component angular 2

I'm using angular 2. I have a scenario where i have a component, interface and directive. This directive is used to for autosuggestions and my interface is used as a model. So whenever user selects a value, I am updating the model and is there a way…
0
votes
2 answers

change detection not working on routed page when first rendered in angular2

i am trying to get google maps values from parent component to route component for which i have created a sharedservice as follow import {Injectable} from 'angular2/core'; import {Subject} from "rxjs/Subject"; @Injectable() export class…
Ironsun
  • 801
  • 2
  • 8
  • 19
0
votes
1 answer

Angular2 with Rx.subject not refreshing the view

Probably I'm missing some Angular2 concept about Change Detection. I've read about NgZones and ChangeDetectionStrategy but none seemed to solve my problem. The case is I have a external module where I store my Observables and consume them in some…
João Mosmann
  • 2,884
  • 19
  • 25
-1
votes
1 answer

OnPush Changedetection for a http service

I want to call a http api and load the data using ChangeDetectionStrategy.OnPush. I know how to go about it using the ChangeDetectorRef by calling detectchanges(). The main component calling the Service is: ngOnInit() { …
-1
votes
2 answers

Why my view is not updated after page is destroyed and i come back with setInterval?

i have two pages APP COMPONENT HTML HELLO PAGE
COUNTER COUNTER HTML

{{ counter }}

COUNTER…
-1
votes
1 answer

Angular change detection on input decorated property

If I decorate my property with @Input decorator and update it via some rest service, will a string interpolated property in a template be updated every time it changes? In a component: @Input() myProperty: string; In a template: {{myProperty}}
Hrvoje T
  • 3,365
  • 4
  • 28
  • 41
-1
votes
1 answer

Problems with Form using ngDoCheck()

I have a form to edit products, which have a name, category and price. I have 2 hardcoded products and 2 buttons, 'load product one' and 'load product two'. When I click 'load product one', edit the product, and then save it (shown by picture one),…
tom
  • 91
  • 1
  • 6
-1
votes
1 answer

Why would we use changeDetection onPush strategy in child component, where there are the maked events?

I learned about change detection strategy - onPush and after that today i meet this video on youtube https://www.youtube.com/watch?v=ybNj-id0kjY where Minko is explaining about faster angular applications. From 7:45 - 11:20 he is saying that - When…
sdsd
  • 447
  • 3
  • 20
-1
votes
1 answer

Angular - change detection in dynamically loaded module/component without using `ChangeDetectorRef`

I compile an Angular module (to load the module dynamically) with compiler's compileModuleAsync and want to insert a component of the module into view. I tried to insert the component into ViewContainer but the component doesn't detect changes…
1 2 3
31
32