1

I'm following the course Staying Sharp With AngularJs.

The course put some code in app.ts:

angular
    .module("NoteWrangler", ["ngRoute"])
    .config(function ($routeProvider: angular.route.IRouteProvider) {
        $routeProvider
            .when("/notes", {
                templateUrl: "templates/pages/notes/index.html"
            });
    });

Ok, so the links are formed like this:

somedomain/index.html/#/myPage

But when I try my urls are build like this:

somedomain/index.html#!/myPage

Why the difference?
Between ".../#/..." and "...#!/..." I mean.
How can I change between these two?

Jonny Piazzi
  • 3,684
  • 4
  • 34
  • 81

2 Answers2

2

Why the difference?

Old versions of Angular used #.

Some years ago, it was changed to use #! so it would play nicely with the (now deprecated) Google Ajax crawling spec.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
1

In angular it's called a shebang and works closely with your ngroute class. This topic contains some elaborate answers

Community
  • 1
  • 1
DGK
  • 2,947
  • 5
  • 32
  • 47