GitHub user doanduyhai opened a pull request:
https://github.com/apache/incubator-zeppelin/pull/741
[Zeppelin-693] Add AngularJS z.angularUnbind()
### What is this PR for?
Add AngularJS `z.angularUnbind()` method
The signature of the method is `angularUnbind(varName, parameters)`.
The parameter is a JSON object that looks like:
```
parameters = {
paragraph: '20160126-153136_1060166247',
paragraphs: ['20160126-171914_843040190',
'20160126-181556_1915782845'],
runParagraphs: false
}
```
* paragraph: paragraph id used to update the angular object repository
* paragraphs: paragraph ids used to update the angular object repository
* runParagraphs: if true, run the paragraphs listed by the properties
paragraph or paragraphs. Default = true (**not implemented yet in this PR, will
be implemented in another PR with the method z.runParagraph()**)
This is a sub-task of epic **[ZEPPELIN-635]**
### What type of PR is it?
[Improvement]
### Todos
* [ ] - Code review
* [ ] - Simple test
### Is there a relevant Jira issue?
**[ZEPPELIN-693]**
### How should this be tested?
* Create a new note
* In the first paragraph, put the following code
```html
%angular
<form class="form-inline">
<div class="form-group">
<label for="superheroId">Super Hero: </label>
<input type="text" class="form-control" id="superheroId"
placeholder="Superhero name ..." ng-model="superhero"></input>
</div>
<button type="submit" class="btn btn-primary"
ng-click="z.angularBind('superhero', superhero, {paragraph:
'PUT_HERE_PARAGRAPH_ID'})"> Angular Bind</button>
<button type="submit" class="btn btn-primary"
ng-click="z.angularUnbind('superhero', {paragraph: 'PUT_HERE_PARAGRAPH_ID'})">
Angular UnBind</button>
</form>
```
* Create a second paragraph with the following code:
```scala
z.getInterpreterContext().getParagraphId()
z.angular("superhero")
```
* Execute the second paragraph to retrieve its paragraph id
* In the first paragraph, replace the text PUT_HERE_PARAGRAPH_ID by the
correct paragraph id
* In the input text, put "Superman" and click on the **Bind Angular** button
* Execute the second paragraph to see that the superhero variable is now
set to Superman
* Now click on the **Unbind Angular** button from the first paragraph
* Refresh the second paragraph to check that the _superhero_ variable has
been removed
### Screenshots (if appropriate)

### Questions:
* Does the licenses files need update? --> **No**
* Is there breaking changes for older versions? --> **No**
* Does this needs documentation? --> **No**
[ZEPPELIN-635]: https://issues.apache.org/jira/browse/ZEPPELIN-635
[ZEPPELIN-693]: https://issues.apache.org/jira/browse/ZEPPELIN-693
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/doanduyhai/incubator-zeppelin ZEPPELIN-693
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-zeppelin/pull/741.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #741
----
commit b6501c77d9eb63a91e4a772acf6703603f9751a5
Author: DuyHai DOAN <[email protected]>
Date: 2016-02-23T10:11:40Z
[ZEPPELIN-689] Add Thrift RPC method angularRegistryPush()
commit a4b5f7c3a56e96271328f05e436e6b60b3017262
Author: DuyHai DOAN <[email protected]>
Date: 2016-02-22T16:45:34Z
[ZEPPELIN-689] Make AngularObject constructor public because of
serialization issue
commit 5746cb73452f139d18df02bf310f3b622dbe20c5
Author: DuyHai DOAN <[email protected]>
Date: 2016-02-22T22:28:11Z
[ZEPPELIN-689] ZeppelinContext angular() method should look for variable
using the paragraph scope then note scope
commit b78d12db1b5d80bdca8d5c146c77c4f4f9ec9758
Author: DuyHai DOAN <[email protected]>
Date: 2016-02-23T10:01:31Z
[ZEPPELIN-689] Implement z.angularBind() function
commit f0f6f89d34a3ad123ded30179f182bf6fdb1e35b
Author: DuyHai DOAN <[email protected]>
Date: 2016-02-23T14:20:46Z
[ZEPPELIN-693] Add AngularJS z.angularUnbind()
----
---
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 [email protected] or file a JIRA ticket
with INFRA.
---