predixdesignsystem / px-card

For a live demo of this predix UI component, visit
https://www.predix-ui.com/#/modules/px-card
Apache License 2.0
1 stars 7 forks source link

px-dashboard.html's seleectedDeckUrl need notify property #2

Closed kwge closed 8 years ago

kwge commented 8 years ago

Could you add notify: true to the following property? selectedDeckUrl: { type: String, observer: "deckUrlChanged", notify: true }, Without the notify, the deckUrlChanged event is not being called consistently.

lrbridge commented 8 years ago

Hmm, I don't understand the problem here. px-dashboard expects you to pass in a selected-deck-url and then it will always call deckUrlChanged observer when that url changes. Notify doesn't have anything to do with the observer being called.

Notify: true would help with broadcasting the event outside of the px-dashboard web component so you could track changes to the selected-deck-url outside of px-dashboard, but since the selected-deck-url isn't being changed inside the dashboard at all, I'm not sure why you'd need this.

Make sense?

kwge commented 8 years ago

The problem is that even the selected-deck-url has changed, it didn�t trigger the deckUrlChanged inside px-dashboard. When we look inside the selectedDeckUrl, it is set to �{{selectedDeck}}�, not the actual value. By adding Notify:true attribute, the value set correctly.

I notice that there is a ng-bing-polymer class in some of the example code, since in our case we are setting the deck in AngJS and pass it to Polymer component, should we use this instead of using Notify: true attribute? What is ng-bing-polymer for anywhere? Thanks.

Kenny

From: lrbridge notifications@github.com<mailto:notifications@github.com> Reply-To: PredixDev/px-card reply@reply.github.com<mailto:reply@reply.github.com> Date: Wednesday, November 18, 2015 at 8:16 PM To: PredixDev/px-card px-card@noreply.github.com<mailto:px-card@noreply.github.com> Cc: Kenny Wong kenny.wong@ge.com<mailto:kenny.wong@ge.com> Subject: Re: [px-card] px-dashboard.html's seleectedDeckUrl need notify property (#2)

Hmm, I don't understand the problem here. px-dashboard expects you to pass in a selected-deck-url and then it will always call deckUrlChanged observer when that url changes. Notify doesn't have anything to do with the observer being called.

Notify: true would help with broadcasting the event outside of the px-dashboard web component so you could track changes to the selected-deck-url outside of px-dashboard, but since the selected-deck-url isn't being changed inside the dashboard at all, I'm not sure why you'd need this.

Make sense?

� Reply to this email directly or view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_PredixDev_px-2Dcard_issues_2-23issuecomment-2D157946245&d=CwMCaQ&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI&r=3CY_Cr0xgsz_V4RT7qBRuvXPH6nGzLpMYx3qqMvkT0M&m=cvFNYRRWuE2XCxlzjlGS0eGrTLuIByZhZXJW3k0ITzE&s=_oBzMIvewTIGgPp_RNzQE_6-RLmzUjaoKDQbj08IyZ4&e=.

lrbridge commented 8 years ago

I'm not sure why notify:true would affect that behavior, maybe it's just a lucky side-effect, since notify:true is really just about broadcasting out, not when the observer within the component is called.

Since you are setting the selected-deck-url in Angular, then I would definitely suggest using ng-bind-polymer. https://github.com/PredixDev/ng-bind-polymer You can see an example working in the predix-seed with px-dashboard, px-deck-selector, and ng-bind polymer.

lrbridge commented 8 years ago

Closing this since I think it's just an Angular/Polymer binding issue, not anything specific to the component.