Skip to content

Commit

Permalink
AMD definition fix
Browse files Browse the repository at this point in the history
"angular || null" will return an error if angular is not defined, not null as expected

this change makes ng-table compatible with requireJS (bug appeared when ng-table was loaded before angular, that can happen at random)
  • Loading branch information
guillaumesmo committed Apr 17, 2014
1 parent 93b4846 commit 81d5795
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ng-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
} else {
return factory(angular);
}
}(angular || null, function(angular) {
}(typeof(angular) === 'undefined' ? null : angular, function(angular) {
'use strict';
/**
* ngTable: Table + Angular JS
Expand Down Expand Up @@ -719,4 +719,4 @@ angular.module('ngTable').run(['$templateCache', function ($templateCache) {
$templateCache.put('ng-table/pager.html', '<div class="ng-cloak ng-table-pager"> <div ng-if="params.settings().counts.length" class="ng-table-counts btn-group pull-right"> <button ng-repeat="count in params.settings().counts" type="button" ng-class="{\'active\':params.count()==count}" ng-click="params.count(count)" class="btn btn-default"> <span ng-bind="count"></span> </button> </div> <ul class="pagination ng-table-pagination"> <li ng-class="{\'disabled\': !page.active}" ng-repeat="page in pages" ng-switch="page.type"> <a ng-switch-when="prev" ng-click="params.page(page.number)" href="">&laquo;</a> <a ng-switch-when="first" ng-click="params.page(page.number)" href=""><span ng-bind="page.number"></span></a> <a ng-switch-when="page" ng-click="params.page(page.number)" href=""><span ng-bind="page.number"></span></a> <a ng-switch-when="more" ng-click="params.page(page.number)" href="">&#8230;</a> <a ng-switch-when="last" ng-click="params.page(page.number)" href=""><span ng-bind="page.number"></span></a> <a ng-switch-when="next" ng-click="params.page(page.number)" href="">&raquo;</a> </li> </ul> </div> ');
}]);
return app;
}));
}));

2 comments on commit 81d5795

@yairy
Copy link

@yairy yairy commented on 81d5795 May 26, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should have happened in the script 01-intro.js and not here - when you run grunt it will concatenate the source file and this change will be overridden.

@dfsq
Copy link

@dfsq dfsq commented on 81d5795 May 26, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yairy Exactly, I fixed it in this PR #307

Please sign in to comment.