You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by co...@apache.org on 2016/09/28 01:40:45 UTC

zeppelin git commit: [ZEPPELIN-1495] Add Good Practice #4

Repository: zeppelin
Updated Branches:
  refs/heads/gh-pages fd772df06 -> 65f45bbc6


[ZEPPELIN-1495] Add Good Practice #4

### What is this PR for?
This Good Practice Guide promotes the usage of `ng-bind` instead of the classic `{{}}` syntax, to have a performance boost.

### What type of PR is it?
Documentation

### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-1495

### How should this be tested?
Outline the steps to test the PR here.

### Screenshots (if appropriate)

### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No

Author: Damien CORNEAU <co...@gmail.com>

Closes #1463 from corneadoug/ZEPPELIN-1495 and squashes the following commits:

102b62b [Damien CORNEAU] Add small update to Guide #1
23e64dc [Damien CORNEAU] Fix escaping of angular {{}}
c420d8a [Damien CORNEAU] Add Good Practice #4


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/65f45bbc
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/65f45bbc
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/65f45bbc

Branch: refs/heads/gh-pages
Commit: 65f45bbc6333d517d9f2d470e928b507f767700a
Parents: fd772df
Author: Damien CORNEAU <co...@gmail.com>
Authored: Wed Sep 28 10:37:48 2016 +0900
Committer: Damien CORNEAU <co...@gmail.com>
Committed: Wed Sep 28 10:40:45 2016 +0900

----------------------------------------------------------------------
 contribution/zeppelinweb/goodPracticeGuide01.md |  2 +-
 contribution/zeppelinweb/goodPracticeGuide03.md |  4 +-
 contribution/zeppelinweb/goodPracticeGuide04.md | 46 ++++++++++++++++++++
 3 files changed, 49 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/65f45bbc/contribution/zeppelinweb/goodPracticeGuide01.md
----------------------------------------------------------------------
diff --git a/contribution/zeppelinweb/goodPracticeGuide01.md b/contribution/zeppelinweb/goodPracticeGuide01.md
index 317bd0f..d486208 100644
--- a/contribution/zeppelinweb/goodPracticeGuide01.md
+++ b/contribution/zeppelinweb/goodPracticeGuide01.md
@@ -25,8 +25,8 @@ limitations under the License.
 We should have only one Angular Component per file, and it should look like this:
 
 ```
+'use strict';
 (function() {
-  'use strict';
 
   angular.module('zeppelinWebApp').controller('HomeCtrl', HomeCtrl);
 

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/65f45bbc/contribution/zeppelinweb/goodPracticeGuide03.md
----------------------------------------------------------------------
diff --git a/contribution/zeppelinweb/goodPracticeGuide03.md b/contribution/zeppelinweb/goodPracticeGuide03.md
index 836271f..09ccd8f 100644
--- a/contribution/zeppelinweb/goodPracticeGuide03.md
+++ b/contribution/zeppelinweb/goodPracticeGuide03.md
@@ -102,7 +102,7 @@ Now let's see how we can use it inside our `.html` view in normal situations.
 
 ```
 <div ng-controller="myNewController as newCtrl">
-  <div ng-click="newCtrl.myControllerPublicFunction">{{ newCtrl.publicVariable }}</div>
+  <div ng-click="newCtrl.myControllerPublicFunction">{{ "{{newCtrl.publicVariable"}}}}</div>
 </div>
 ```
 
@@ -126,7 +126,7 @@ Which will leave the `.html` view without any `ng-controller` property.
 
 ```
 <div>
-  <div ng-click="newCtrl.myControllerPublicFunction">{{ newCtrl.publicVariable }}</div>
+  <div ng-click="newCtrl.myControllerPublicFunction">{{ "{{newCtrl.publicVariable"}}}}</div>
 </div>
 ```
 

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/65f45bbc/contribution/zeppelinweb/goodPracticeGuide04.md
----------------------------------------------------------------------
diff --git a/contribution/zeppelinweb/goodPracticeGuide04.md b/contribution/zeppelinweb/goodPracticeGuide04.md
new file mode 100644
index 0000000..ec5286e
--- /dev/null
+++ b/contribution/zeppelinweb/goodPracticeGuide04.md
@@ -0,0 +1,46 @@
+---
+layout: sideMenu
+title: "4 - Using ng-bind"
+description: ""
+group: nav-contrib-front
+menu: nav-contrib-front
+---
+<!--
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+# Performance Gain Using ng-bind
+
+<br/>
+We recommend the usage of `ng-bind` in your views.
+
+It allows some performance improvements compared to the usual `{{ "{{ " }}}}` syntax, without adding too much code complexity.
+
+Your code would then look like:
+
+```
+<div ng-bing='home.myValue'></div>
+```
+
+Instead of:
+
+```
+<div>
+{{ "{{home.myValue"}}}}
+</div>
+```
+
+#### Learn More
+
+The topic has been discussed a lot, and you can follow some of these discussions [here](https://github.com/toddmotto/angular-styleguide/issues/41) or
+[there](http://stackoverflow.com/questions/27097006/angularjs-why-is-ng-bind-faster-than-expressions).