From bbdc103c870087a86cebe11893b57cbbd3ca72ba Mon Sep 17 00:00:00 2001 From: fefa4ka Date: Wed, 21 Oct 2015 14:08:59 +0300 Subject: [PATCH] tabs fix --- zsite/static/js/app.js | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/zsite/static/js/app.js b/zsite/static/js/app.js index eb85ca9..6169d4c 100644 --- a/zsite/static/js/app.js +++ b/zsite/static/js/app.js @@ -31,30 +31,29 @@ angular.module('zuykov') // GetAdj(6,'свежее', 'свежих') // Вернет «свежих» }]) -.controller('TabsCtrl', ['$scope', function ($scope) { +.controller('ngTabsCtrl', ['$scope', function ($scope) { + $scope.tabs = { + index: 0, + count: 0 + }; + + this.headIndex = 0; + this.bodyIndex = 0; + + this.getTabHeadIndex = function() { + return $scope.tabs.count = ++this.headIndex; + }; + + this.getTabBodyIndex = function() { + return ++this.bodyIndex; + }; }]) .directive( 'ngTabs', function() { return { scope: true, restrict: 'EAC', - controller: function( $scope ) { - $scope.tabs = { - index: 0, - count: 0 - }; - - this.headIndex = 0; - this.bodyIndex = 0; - - this.getTabHeadIndex = function() { - return $scope.tabs.count = ++this.headIndex; - }; - - this.getTabBodyIndex = function() { - return ++this.bodyIndex; - }; - } + controller: 'ngTabsCtrl' }; })