GitHub user Leemoonsoo opened a pull request:
https://github.com/apache/incubator-zeppelin/pull/591
Utilities for Angular Display system
### What is this PR for?
[Angular display
system](http://zeppelin.incubator.apache.org/docs/0.6.0-incubating-SNAPSHOT/displaysystem/angular.html)
provides way to Interpreter interact with front-end.
However, the api was pretty much low level and not very much intuitive, it
was difficult to make readable code. This PR provides simple intuitive API for
using angular display system by leveraging scala.xml. Following is usage
Import
```scala
import org.apache.zeppelin.display._
import AngularElem._
```
Display element
```scala
// automatically convert to string and print with %angular display system
directive in front.
<div><div>.display
```
Event handler
```scala
// on click
<div></div>.onClick(() => {
my callback routine
}).display
// on change
<div></div>.onChange(() => {
my callback routine
}).display
// arbitrary event
<div></div>.onEvent("ng-click", () => {
my callback routine
}).display
```
Bind model
```scala
// bind model
<div></div>.model("myModel").display
// bind model with initial value
<div></div>.model("myModel", initialValue).display
```
Interact with model
```scala
// read model
AngularModel("myModel")()
// update model
AngularModel("myModel", "newValue")
```
### What type of PR is it?
Feature
### Todos
### Is there a relevant Jira issue?
### How should this be tested?
See usage and screenshot
### Screenshots (if appropriate)
Example of basic usage

Example of string converter

### Questions:
* Does the licenses files need update? no
* Is there breaking changes for older versions? no
* Does this needs documentation? documentation will follow
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/Leemoonsoo/incubator-zeppelin display_utils
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-zeppelin/pull/591.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 #591
----
commit 777ba16533042c27d27473db5003d8ed3ce64be0
Author: Lee moon soo <[email protected]>
Date: 2016-01-02T01:40:44Z
Initial commit of zeppelin-display-utils
commit 991fd1f13ec315ca15160512a97350c7bd09f6a2
Author: Lee moon soo <[email protected]>
Date: 2016-01-02T01:58:40Z
fix test
commit fa4e72b9aed01ea10d638fe7a2639f0df8e9a2db
Author: Lee moon soo <[email protected]>
Date: 2016-01-02T05:35:53Z
Using onEvent based on AngularObject
commit 819b7c37407911dc356dd7c15397de2ecdbcfbc5
Author: Lee moon soo <[email protected]>
Date: 2016-01-02T07:55:50Z
add display method
commit f14b0ffb8c22714bec08b03cce34cc1367d242cd
Author: Lee moon soo <[email protected]>
Date: 2016-01-02T18:09:56Z
AngularModel
commit e0ce18f1d259b3d94f8a4f4c6846cadb45f5d288
Author: Lee moon soo <[email protected]>
Date: 2016-01-02T19:28:24Z
set InterpreterContext for callback function
----
---
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.
---