From c420d8ad34ee670ce215105c5516ac9d3ad0748c Mon Sep 17 00:00:00 2001 From: Damien CORNEAU Date: Tue, 27 Sep 2016 15:04:46 +0900 Subject: [PATCH 1/3] Add Good Practice #4 --- .../zeppelinweb/goodPracticeGuide04.md | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 contribution/zeppelinweb/goodPracticeGuide04.md diff --git a/contribution/zeppelinweb/goodPracticeGuide04.md b/contribution/zeppelinweb/goodPracticeGuide04.md new file mode 100644 index 00000000000..c864d68dfb5 --- /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 +--- + + +# Performance Gain Using ng-bind + +
+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: + +``` +
+``` + +Instead of: + +``` +
+ {{home.myValue}} +
+``` + +#### 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). From 23e64dcceb2d5a4c983cfabac7494aabcedf9afa Mon Sep 17 00:00:00 2001 From: Damien CORNEAU Date: Tue, 27 Sep 2016 15:37:19 +0900 Subject: [PATCH 2/3] Fix escaping of angular {{}} --- contribution/zeppelinweb/goodPracticeGuide03.md | 4 ++-- contribution/zeppelinweb/goodPracticeGuide04.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contribution/zeppelinweb/goodPracticeGuide03.md b/contribution/zeppelinweb/goodPracticeGuide03.md index 836271ffe81..09ccd8f6be3 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. ```
-
{{ newCtrl.publicVariable }}
+
{{ "{{newCtrl.publicVariable"}}}}
``` @@ -126,7 +126,7 @@ Which will leave the `.html` view without any `ng-controller` property. ```
-
{{ newCtrl.publicVariable }}
+
{{ "{{newCtrl.publicVariable"}}}}
``` diff --git a/contribution/zeppelinweb/goodPracticeGuide04.md b/contribution/zeppelinweb/goodPracticeGuide04.md index c864d68dfb5..ec5286e6f1c 100644 --- a/contribution/zeppelinweb/goodPracticeGuide04.md +++ b/contribution/zeppelinweb/goodPracticeGuide04.md @@ -36,7 +36,7 @@ Instead of: ```
- {{home.myValue}} +{{ "{{home.myValue"}}}}
``` From 102b62bb001cfbcac421a2a576eb8bd7a387b35c Mon Sep 17 00:00:00 2001 From: Damien CORNEAU Date: Wed, 28 Sep 2016 10:37:48 +0900 Subject: [PATCH 3/3] Add small update to Guide #1 --- contribution/zeppelinweb/goodPracticeGuide01.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contribution/zeppelinweb/goodPracticeGuide01.md b/contribution/zeppelinweb/goodPracticeGuide01.md index 317bd0f5ac4..d486208731b 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);