Skip to content

Commit

Permalink
fix(pagination): Updated pagination hack
Browse files Browse the repository at this point in the history
Now edits original template rather than replacing it - should make it
resilient in spite of upgrades.
  • Loading branch information
atruskie committed Mar 31, 2016
1 parent f77f2ac commit 97fa379
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ angular.module(
.run([
"$templateCache",
function($templateCache) {
// override bootstrap-ui's default template
var newTemplate = $templateCache.get("components/directives/angular-ui/bootstrap/pagination/pagination.tpl.html");
$templateCache.put("template/pagination/pagination.html", newTemplate);
// add ng-href and remove ng-click
const
targetTemplate = "uib/template/pagination/pagination.html",
pageRegex = /(href).*(?:ng-click="selectPage\(([^,]+), \$event\)")/gm,
replaceString = `ng-href="{{ $parent.$parent.getPaginationLink($2) }}" href`;

var oldTemplate = $templateCache.get(targetTemplate);

var newTemplate = oldTemplate.replace(pageRegex, replaceString);

$templateCache.put(targetTemplate, newTemplate);
}]);


This file was deleted.

0 comments on commit 97fa379

Please sign in to comment.