I am new to Angular, and am trying to do some evaluation for how I should 
proceed with a few issues. The big one I am needing to discern is 
performance. This is made worse by the fact that I have zero real world 
knowledge of how to measure performance, or how to write performance 
benchmarks.

But to boil it down, I have a situation where I am presently using an *isolate 
scope* on a directive. I thought at first that an isolate scope was very 
desired because it was a slimmer object, and therefore faster performance. 
However, when I tried it in practice, I saw that the scope generated this 
way is just as large as the normal controller scope.

So my question is basically ... is there any performance reason to use an 
isolate scope? It actually looks as it though it should make things *slower*. 
Example code below;


angular.module('app', [])
.controller('HomeController', ['$scope','$parse', function($scope, $parse){
   $scope.Model = {}; $scope.Mode = { Editing: false };
   console.log('controller scope: ', $scope);
}]).directive('editModeOptions', [ '$parse', function($parse) {
   return {
      restrict: 'A',
      scope: {
         kEditMode: '=',
         kOptions: '='
      },
      link: function(scope, element, attributes) {
         var values = scope.$eval(scope.GridColumns),
             options = scope.kOptions,
             mode = scope.kEditMode;

         // do stuff with the various parameters
         console.log('isolate scope: ', scope);
      }
   }
}]);

And then attach them very simply.

<div ng-app="app" ng-controller="HomeController">
<div k-edit-mode="Mode.Editing" k-options="options.grid" 
grid-columns="['Id','Name','Abbreviation','Group']"></div>
<h1>{{ Mode.Editing }}</h1>
</div>

And this outputs two rather sizable *scope* objects.

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to