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,608
  • 4
  • 31
  • 77

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
  • 857,932
  • 118
  • 1,152
  • 1,264
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,717
  • 3
  • 29
  • 44