angular


Angular 2 pipe triggering


I have a collection of models. In template I use pipe
<div class="card-panel" *ngFor="let card of cards | sortByType">
<card-view [card]="card" [autoupdate]="true"></card-view>
</div>
In each component I have a timer for update data. But when model is updated, pipe didn't run again. Is there way to force run pipe or do some angular way in this situation.
In card-view I have a timer that updated card variable. But Angular don't catch this changes for triggering pipe
You can create a copy of cards than Angular2 change detection detects the change and executes the pipe again.
You can make the pipe impure
#Pipe({ name: 'sortByType', pure: false})
this causes your pipe to be executed every time change detection is run.
You can do custom change detection using the IterableDiffer, and return cached result when the array didn't actually change.
With this option you have to be careful to not cause serious performance degradation.
You can pass an additional parameter to the pipe that you update (for example a number that gets increased every time the array changes.
This way the pipe gets called because Angular change detection calls the pipe every time the value or a parameter changes.
A disadvantage is that it is a bit more cumbersome to use.

Related Links

Angular2 - EXCEPTION: TypeError: Cannot read property 'screen' of undefined
Angular 2: onChanges() is not reflecting Object value changes
How to call ViewChild in runtime?
Angular2 not detecting change to object value
Getting values of looped template using angular2 forms
Breeze and Angular2
Angular 2 hide/show template
Angular 2 RC1 - Auto import all used components inside a base component
Add Lodash to VS2015 Angular2 Project
cannot find module errors after upgrading to angular-2.0.0-rc.4
Angular 2 don't dectect change on an Observable
Convert date in format accepted by restService
Reset forms in Angular2
Angular 2 - App Component Protect
GetSentry RavenJS not importing in webpack build
Wait for Angular 2 to load/resolve FormBuilder/ControlGroups before rendering view/template

Categories

HOME
selenium-webdriver
firebase-authentication
data-warehouse
owasp
entities
logistic-regression
google-cloud-kms
64bit
timezone
pymc
chat
flannel
shoutem
wmi-query
double
odbc
mysql-error-1064
packet-capture
boto
avaya
week-number
byte
modeling
drools-fusion
free-jqgrid
tablet
scada
toml
gobject
digestive-functors
notnull
c#-6.0
spring-cloud-sleuth
uievent
azure-sql-server
multibox
auto-value
clisp
rt
sqlitestudio
showdown
generated
release-management
xml-rpc
scodec
google-api-v3
spring-java-config
sequencing
pubsubhubbub
compass
qtquick2
test-and-target
jquery-ui-resizable
struts2-jquery-grid
realbasic
steroids
ssas-2008
utilities
cpanm
pixman
zipcode
topological-sort
ironscheme
code-completion
scrollviewer
ember-qunit
tokumx
control-center
datacontext
linq-to-lucene
stockquotes
resourcedictionary
fluent-security
scite
craftyjs
fubumvc
fold
struts2-tiles-plugin
circular-reference
firepad
java-service-wrapper
converters
ejbql
phonetics
addr2line
dvorak
sts-securitytokenservice
scopes
ext-direct
python-sockets
google-ad-manager
webarchive
iasyncresult
silverlight-embedded
eda
windows-explorer
winqual
urldecode
habari
sqlmetal

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App