1

Here, how I have configured the routing

var config = function (rp) {
    rp.when(
        '/docs',
        {
            templateUrl: 'Docs.htm'
        }
    );
};
config.$inject = ['$routeProvider'];
app.config(config);

then I added

<a href="#docs">Docs</a>

to my htm page.

when the link is clicked, URL is changed to

my_pagename.htm#!#docs

and it does not load the template.

but when I manually type the URL in location as

my_pagename.htm#!/docs (replaced hash symbol with '/')

it loads fine.

Can you please tell me the error here?

what is the proper way of specifying the href attribute, in order to work with angular routing? My angular version is 1.6.3

bula
  • 8,719
  • 5
  • 27
  • 44

2 Answers2

0

Why did you add # with href

try this

<a href="docs">Docs</a>
CognitiveDesire
  • 774
  • 5
  • 20
0

I don't know the consequences, but I changed the hrefs to

    #!/<link>

Ex: #!/docs
    #!/contacts

and now they work fine.

note that I didn't change route paths in js file.

bula
  • 8,719
  • 5
  • 27
  • 44