javascript - AngularJS Routing Issue with named groups -
i have basic application runing localy using apache/wamp etc. setup fine, , i've built quite few apps using , angularjs.
previous apps used ui-router route/state build. app i'm building using normal ngroute , ng-view.
issue: using $routeprovider setup 2 routes.
app.js ( basic setup angular-route added scripts , "ngroute" added deps )
$locationprovider.html5mode(true); $routeprovider.when("/", {template: "<div>home</div> <a href='/single'>single</a> | <a href='/page/34'>page 34</a>"}); $routprovider.when("/single", {template: "<div>single</div>"}); $routprovider.when("/page/:pageid", {template: "<div>page</div>"}); $routeprovider.otherwise("/");
.htaccess
rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^ index.php [l]
when run app "/" ok. using anchors app switch views no issues
when start app @ "/single" fine
when start app @ "/page/34" module error stating module "application" wasn't loaded...weird. routes named groups or longer straight page, e.g. /page/something don't work. doesn't matter route is.
i'm perplexed.
thanks clarification.
is there i'm missing? can't figure out why doesn't work.
update
fell prey bug. see post: https://stackoverflow.com/a/17882453/2012550
do mean have html5mode(true);
?
this expects server know no matter path requested, index file should served angular can handle real routing on front end. remove line , notice #/
in path
Comments
Post a Comment