Github user doanduyhai commented on the pull request:

    https://github.com/apache/incubator-zeppelin/pull/740#issuecomment-191840961
  
    > In this perspective, i'm not sure it's good to embed run paragraph inside 
of z.angularBind() function in front-end side, while corresponding api in 
backend side does not.
    
     Ok, I see your point now. The table showing back-end and front-end API is 
quite clear. So I'll remove the `runParagraph` attribute. If user want to 
trigger paragraph execution they can use `z.runParagraph()`
    
    > htmlElement is html Element that created by user code in the paragraph.
    That's only way i know get current paragraph id from the javascript that 
defined in particular paragraph.
    
    Your idea can work if we have a paragraph defining HTML element. But what 
if I want to bind Angular value to a SparkSQL paragraph or Cassandra paragraph ?
    
    ```sql
    %sql
    SELECT * FROM my_table WHERE id = ${id}
    ```
    
    ```sql
    %cassandra
    SELECT * FROM table WHERE key=${key}
    ```
    
     There is **no** HTML element so I cannot retrieve the paragraph Id using 
DOM JS function... The only way is to rely on **paragraph id**, or maybe 
**paragraph title** but we don't have **unicity guarantee** when using title ...
    
    > paragraph id can not be simply changed, while of some features (rest api 
to run paragraph, iframe link, ...) and a lot of internal code (angulardisplay 
system, job scheduler, etc) assumes paragraph id is immutable.
    
     No no, I think there is a **misunderstanding** here. I don't want to 
change the paragraph id. What I want is that **on Import, we keep the original 
paragraph id** and don't generate a new one every time so that 
`z.angularBind('val', val, {paragraphId: 'xxxx'})`  is re-usable and does not 
break when sharing or importing/exporting notes
    
     To enable this behavior, **there is very few change to the code base**, 
see the diff **[here](https://gist.github.com/doanduyhai/350ddf29cedd4ca37f45)**
    
    The result seems working well with import/export and clone
    
    
![testimport-export_clone](https://cloud.githubusercontent.com/assets/1532977/13501070/db0a023c-e16d-11e5-97d3-d2c105d04f14.gif)
    
    > Right, that's what i wanted to say actually :-)
    
     So there is no problem, we both agree that `z.angularBind()` should **bind 
value to only one paragraph** right ?
    
    >  i can convert it to "how to initiate angularObject binding from the 
front-end code?" Because passing variable from front end to back end is already 
possible once they're binded.
    
    
     Exactly, so `z.angularBind()` is here to fill in the gap and allow to 
initiate a new binding to an Angular variable from front-end.
    
    <hr/>
    
     So to conclude, we indeed agree on many things. I propose the following 
next steps:
    
     1. Rework this PR to remove `runParagraph` so we decouple 
`z.angularBind()` and `z.runParagrap()`
     2. Create another PR to keep the original paragraph id every time we 
import a note, based on the patch I showed
    
    
    WDYT @Leemoonsoo ?
    



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to