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

What is the best practice to manage sessions with Ionic 2
Angular 2 Updating Component After Form Submit With New Data From Response
How to configure and use Auth-0 in Angular4
How to get meta tags work correctly in angular 2? [closed]
Angular2-highcharts switching option
How to make ViewChild work in a unit test
Angular 2 AOT: Getting lot of errors in index.d.ts
Angular2 doesn't work Custom Reuse Strategy with Lazy module loading
view not updated while changing class variable value angular2
Using Angular 2, how can I allow robots.txt to be viewed without angular routing being triggered?
Angular2 Google sign
Angular2 : Async Pipe and conditional styling. How to refactor my code?
Angular 2 attribute directive to clear textbox?
How to get asynchronous data from one Angular component to another
Looping using ngFor and skip nth element
How to populate a dropdown list default value from API in Angular2 Model based form

Categories

HOME
coldfusion
gradle
firebase-authentication
rabbitmq
properties
refactoring
autodesk-forge
https
fiware
dfa
post
reactor-netty
asp.net-web-api2
glusterfs
xhtml
tensorboard
delay
jasperserver
lokijs
axon
shogun
dht
spring-boot-actuator
couchbase-view
moshi
probability-theory
postmates
jsx
gembox-document
scons
hibernate-criteria
bing-api
wijmo5
pgadmin
povray
python-tesseract
hp-quality-center
multiple-domains
word
get-eventlog
nestedscrollview
javapoet
psftp
initializing
scada
smartassembly
ats
model-driven
interstitial
khan-academy
zlib
rufus-scheduler
friend-function
case-sensitive
sqlitestudio
subtitle
appharbor
tivoli-identity-manager
inputstreamreader
sp-executesql
strconv
jquery-ui-tabs
icingaweb2
ngdoc
siteminder
pubsubhubbub
post-commit
nested-forms
test-and-target
iis-8.5
anthill
f#-interactive
heapsort
singularitygs
pysftp
pixman
soundex
allocation
orchardcms-1.6
review
sequel
httplib
mooc
xcode-instruments
worklight-studio
toplink
icommand
kendo-tooltip
remotipart
mdbtools
robohelp
xemacs
actinic
umbraco5
endl
kiln
juggernaut
cocos2d-python
trx
zend-navigation
open-flash-chart
dynamic-css
open-basedir
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