top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to go back to the prev page in angular js?

+2 votes
174 views
How to go back to the prev page in angular js?
posted Jun 10, 2015 by Khusboo

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

AngularJS directive to create a functional "back" button

directives.js

app.directive('backButton', function(){
    return {
      restrict: 'A',

      link: function(scope, element, attrs) {
        element.bind('click', goBack);

        function goBack() {
          history.back();
          scope.$apply();
        }
      }
    }
});

index.html

<a href back-button>back</a>
answer Jan 19, 2017 by Pramod Huilgol
Similar Questions
+1 vote

I have a group of array in $scope.firstorder. For example:

enter image description here

Based on some condition like array contains an element Quantity. If Qunatity is zero i need to remove this array from the list of arrays.

How can I do that?

 for (index in $scope.firstorder)
    {
        var quantity = $scope.firstorder[index][0].Quantity;
        if (quantity == 0)
        {
            Remove the array element from $scope.firstOrder;
        } 


    }
...