data from socket doesn't show in view Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Nativescript - Pass array from home-view-model to home.jsissue with controller somehow preventing my view widgets to showTap on event inside List-ViewAttaching Data To View NativeScript NG2Nativescript App Not Printing to ConsoleTap event not working on html view nativescriptHow to show the most right scroll view item which it's items are dynamic?Nativescript observable/async won't show in ListViewAngular6/Socket: socket call triggers “console.log()”, but fails in other functionsHow do I get value from the custom component Floating Label?
Did Krishna say in Bhagavad Gita "I am in every living being"
Significance of Cersei's obsession with elephants?
Has negative voting ever been officially implemented in elections, or seriously proposed, or even studied?
ArcGIS Pro Python arcpy.CreatePersonalGDB_management
Using et al. for a last / senior author rather than for a first author
Disembodied hand growing fangs
Question about debouncing - delay of state change
Trademark violation for app?
How can I reduce the gap between left and right of cdot with a macro?
Why do we need to use the builder design pattern when we can do the same thing with setters?
What do you call the main part of a joke?
Should I use a zero-interest credit card for a large one-time purchase?
Does the Weapon Master feat grant you a fighting style?
Is it fair for a professor to grade us on the possession of past papers?
As a beginner, should I get a Squier Strat with a SSS config or a HSS?
When a candle burns, why does the top of wick glow if bottom of flame is hottest?
An adverb for when you're not exaggerating
How would a mousetrap for use in space work?
Export Xpubkey from Bitcoin Core
How do living politicians protect their readily obtainable signatures from misuse?
Did Deadpool rescue all of the X-Force?
Can a new player join a group only when a new campaign starts?
Are all finite dimensional hilbert spaces isomorphic to spaces with Euclidean norms?
Find 108 by using 3,4,6
data from socket doesn't show in view
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Nativescript - Pass array from home-view-model to home.jsissue with controller somehow preventing my view widgets to showTap on event inside List-ViewAttaching Data To View NativeScript NG2Nativescript App Not Printing to ConsoleTap event not working on html view nativescriptHow to show the most right scroll view item which it's items are dynamic?Nativescript observable/async won't show in ListViewAngular6/Socket: socket call triggers “console.log()”, but fails in other functionsHow do I get value from the custom component Floating Label?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I get data from socket io but doesn't show in view.
I have this function in ts:
socketIO.on('hello', (data) =>
console.log('data', data);
this.mydata= data;
);
Data in console show like this:
data
"nr": "123456789456"
in htm Nativescript:
<StackLayout >
<Label [text]='mydata'></Label>
</StackLayout>
How to display in view my data? In console data show correctly
add a comment |
I get data from socket io but doesn't show in view.
I have this function in ts:
socketIO.on('hello', (data) =>
console.log('data', data);
this.mydata= data;
);
Data in console show like this:
data
"nr": "123456789456"
in htm Nativescript:
<StackLayout >
<Label [text]='mydata'></Label>
</StackLayout>
How to display in view my data? In console data show correctly
I can see thatdatais JSON. You should convert it to string likeJSON.stringify(data). If it still not works, try this syntax[(ngModel)]="mydata"
– Juky
Mar 22 at 10:57
add a comment |
I get data from socket io but doesn't show in view.
I have this function in ts:
socketIO.on('hello', (data) =>
console.log('data', data);
this.mydata= data;
);
Data in console show like this:
data
"nr": "123456789456"
in htm Nativescript:
<StackLayout >
<Label [text]='mydata'></Label>
</StackLayout>
How to display in view my data? In console data show correctly
I get data from socket io but doesn't show in view.
I have this function in ts:
socketIO.on('hello', (data) =>
console.log('data', data);
this.mydata= data;
);
Data in console show like this:
data
"nr": "123456789456"
in htm Nativescript:
<StackLayout >
<Label [text]='mydata'></Label>
</StackLayout>
How to display in view my data? In console data show correctly
edited Mar 22 at 10:21
ona bin
asked Mar 22 at 10:03
ona binona bin
52
52
I can see thatdatais JSON. You should convert it to string likeJSON.stringify(data). If it still not works, try this syntax[(ngModel)]="mydata"
– Juky
Mar 22 at 10:57
add a comment |
I can see thatdatais JSON. You should convert it to string likeJSON.stringify(data). If it still not works, try this syntax[(ngModel)]="mydata"
– Juky
Mar 22 at 10:57
I can see that
data is JSON. You should convert it to string like JSON.stringify(data). If it still not works, try this syntax [(ngModel)]="mydata"– Juky
Mar 22 at 10:57
I can see that
data is JSON. You should convert it to string like JSON.stringify(data). If it still not works, try this syntax [(ngModel)]="mydata"– Juky
Mar 22 at 10:57
add a comment |
5 Answers
5
active
oldest
votes
Make sure you are running inside ngZone
....
constructor(private zone:NgZone)
super()
....
socketIO.on('hello', (data) =>
this.zone.run(()=>
console.log('data', data);
this.mydata= data;
);
);
add a comment |
you can use binding like this -
<StackLayout >
<Label text= mydata ></Label>
</StackLayout>
Let me know if it works.
For further reading read docs here
Doesn't show and like this binding. I put in my post and JSON data
– ona bin
Mar 22 at 10:20
add a comment |
can you try like this
TS:
mydata: any;
const self = this;
socketIO.on('hello', (data) =>
console.log('data', data);
self.mydata= data;
);
HTML:
<StackLayout>
<Label [text]='mydata'></Label>
</StackLayout>
let me know if it works
add a comment |
From console's output I see that data is an object. Shouldn't the [text] input on <Label> be a string?
add a comment |
You may have to trigger change detection after assignent
https://angular.io/api/core/ChangeDetectorRef#markforcheck
class componant
constructor(private cdf:ChangeDetectorRef)
socketIO.on('hello', (data) =>
console.log('data', data);
this.mydata= data;
this.cdf.markForCheck()
);
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55297180%2fdata-from-socket-doesnt-show-in-view%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
Make sure you are running inside ngZone
....
constructor(private zone:NgZone)
super()
....
socketIO.on('hello', (data) =>
this.zone.run(()=>
console.log('data', data);
this.mydata= data;
);
);
add a comment |
Make sure you are running inside ngZone
....
constructor(private zone:NgZone)
super()
....
socketIO.on('hello', (data) =>
this.zone.run(()=>
console.log('data', data);
this.mydata= data;
);
);
add a comment |
Make sure you are running inside ngZone
....
constructor(private zone:NgZone)
super()
....
socketIO.on('hello', (data) =>
this.zone.run(()=>
console.log('data', data);
this.mydata= data;
);
);
Make sure you are running inside ngZone
....
constructor(private zone:NgZone)
super()
....
socketIO.on('hello', (data) =>
this.zone.run(()=>
console.log('data', data);
this.mydata= data;
);
);
answered Mar 22 at 11:02
ManojManoj
8,19921024
8,19921024
add a comment |
add a comment |
you can use binding like this -
<StackLayout >
<Label text= mydata ></Label>
</StackLayout>
Let me know if it works.
For further reading read docs here
Doesn't show and like this binding. I put in my post and JSON data
– ona bin
Mar 22 at 10:20
add a comment |
you can use binding like this -
<StackLayout >
<Label text= mydata ></Label>
</StackLayout>
Let me know if it works.
For further reading read docs here
Doesn't show and like this binding. I put in my post and JSON data
– ona bin
Mar 22 at 10:20
add a comment |
you can use binding like this -
<StackLayout >
<Label text= mydata ></Label>
</StackLayout>
Let me know if it works.
For further reading read docs here
you can use binding like this -
<StackLayout >
<Label text= mydata ></Label>
</StackLayout>
Let me know if it works.
For further reading read docs here
answered Mar 22 at 10:07
TodarmalTodarmal
11610
11610
Doesn't show and like this binding. I put in my post and JSON data
– ona bin
Mar 22 at 10:20
add a comment |
Doesn't show and like this binding. I put in my post and JSON data
– ona bin
Mar 22 at 10:20
Doesn't show and like this binding. I put in my post and JSON data
– ona bin
Mar 22 at 10:20
Doesn't show and like this binding. I put in my post and JSON data
– ona bin
Mar 22 at 10:20
add a comment |
can you try like this
TS:
mydata: any;
const self = this;
socketIO.on('hello', (data) =>
console.log('data', data);
self.mydata= data;
);
HTML:
<StackLayout>
<Label [text]='mydata'></Label>
</StackLayout>
let me know if it works
add a comment |
can you try like this
TS:
mydata: any;
const self = this;
socketIO.on('hello', (data) =>
console.log('data', data);
self.mydata= data;
);
HTML:
<StackLayout>
<Label [text]='mydata'></Label>
</StackLayout>
let me know if it works
add a comment |
can you try like this
TS:
mydata: any;
const self = this;
socketIO.on('hello', (data) =>
console.log('data', data);
self.mydata= data;
);
HTML:
<StackLayout>
<Label [text]='mydata'></Label>
</StackLayout>
let me know if it works
can you try like this
TS:
mydata: any;
const self = this;
socketIO.on('hello', (data) =>
console.log('data', data);
self.mydata= data;
);
HTML:
<StackLayout>
<Label [text]='mydata'></Label>
</StackLayout>
let me know if it works
answered Mar 22 at 10:24
Yash RamiYash Rami
46137
46137
add a comment |
add a comment |
From console's output I see that data is an object. Shouldn't the [text] input on <Label> be a string?
add a comment |
From console's output I see that data is an object. Shouldn't the [text] input on <Label> be a string?
add a comment |
From console's output I see that data is an object. Shouldn't the [text] input on <Label> be a string?
From console's output I see that data is an object. Shouldn't the [text] input on <Label> be a string?
answered Mar 22 at 10:47
mbojkombojko
2,3111314
2,3111314
add a comment |
add a comment |
You may have to trigger change detection after assignent
https://angular.io/api/core/ChangeDetectorRef#markforcheck
class componant
constructor(private cdf:ChangeDetectorRef)
socketIO.on('hello', (data) =>
console.log('data', data);
this.mydata= data;
this.cdf.markForCheck()
);
add a comment |
You may have to trigger change detection after assignent
https://angular.io/api/core/ChangeDetectorRef#markforcheck
class componant
constructor(private cdf:ChangeDetectorRef)
socketIO.on('hello', (data) =>
console.log('data', data);
this.mydata= data;
this.cdf.markForCheck()
);
add a comment |
You may have to trigger change detection after assignent
https://angular.io/api/core/ChangeDetectorRef#markforcheck
class componant
constructor(private cdf:ChangeDetectorRef)
socketIO.on('hello', (data) =>
console.log('data', data);
this.mydata= data;
this.cdf.markForCheck()
);
You may have to trigger change detection after assignent
https://angular.io/api/core/ChangeDetectorRef#markforcheck
class componant
constructor(private cdf:ChangeDetectorRef)
socketIO.on('hello', (data) =>
console.log('data', data);
this.mydata= data;
this.cdf.markForCheck()
);
answered Mar 22 at 11:25
AbdulKareemAbdulKareem
452314
452314
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55297180%2fdata-from-socket-doesnt-show-in-view%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I can see that
datais JSON. You should convert it to string likeJSON.stringify(data). If it still not works, try this syntax[(ngModel)]="mydata"– Juky
Mar 22 at 10:57