angularjs - Routing for Home Page and URL's for Website -
i'm creating website multiple html files linked ionic framework , using angularjs transfer between states. wondering # means in href , role plays in state transfer. if have href on text
<a href="#/app/page2">hi</a>
is there way configure url instead of saying localhost/index.html#/app/page2
, localhost/index.html/page2
without "#/app"
? i've tried
$locationprovider.html5mode(true);
but didn't work
first, means #
in url
any url contains # character fragment url. portion of url left of # identifies resource can downloaded browser , portion on right, known fragment identifier, specifies location within resource
read more here -> source
putting in other words: portion after #
can "served" without making whole http request. in fact portion after #
never sent in http request.
by default angularjs works #
in urls. means angular router fetch urls if have #. in controller, can catch request , fetch required data using ajax.
http://example.com/#/about http://example.com/#/contact
you can disable enabling html5mode
, can putting in router config:
$locationprovider.html5mode(true);
so urls should looks these , angular router should works fine.
http://example.com/about http://example.com/contact
i recommend not using # urls, kinda old. option working using normal urls.
Comments
Post a Comment