refactor(ionNavBackButton): make click handler use $ionicNgClick service

Closes #802
This commit is contained in:
Andy Joslin
2014-03-15 09:24:24 -06:00
parent 90f360c827
commit 0ffb748fc7
2 changed files with 14 additions and 13 deletions

View File

@@ -282,7 +282,7 @@ function($ionicViewService, $rootScope, $animate, $compile, $parse) {
* </ion-nav-bar>
* ```
*/
.directive('ionNavBackButton', [function() {
.directive('ionNavBackButton', ['$ionicNgClick', function($ionicNgClick) {
return {
restrict: 'E',
require: '^ionNavBar',
@@ -292,8 +292,9 @@ function($ionicViewService, $rootScope, $animate, $compile, $parse) {
'<button class="button back-button" ng-transclude>' +
'</button>',
link: function($scope, $element, $attr, navBarCtrl) {
$scope.$navBack = navBarCtrl.back;
if (!$attr.ngClick) {
ionic.on('tap', navBarCtrl.back, $element[0]);
$ionicNgClick($scope, $element, '$navBack($event)');
}
//If the current viewstate does not allow a back button,