Search code examples
angularjsangularjs-ng-include

ng-include how to make a orderBy to an object


I'm aware that Angular filters can only be applied to arrays, not objects

I'm attempting to include templates added dynamically using the following code. All seems to work well until you see the order

What I would like to have this order:

Create Book Address

here is the Plunker


Solution

  • Instead of using a key-value object, why not use an array? ng-repeat orders the iteration by the index of the iterated object/array.

    FORKED DEMO

      $scope.templates = [
        'create.html',
        'book.html',
        'address.html'
      ];