Thank you very much :) On Thursday, June 12, 2014 3:13:17 PM UTC+2, Chris Rhoden wrote: > > The catch-all route should be in angular, and should parameterize some > portion of it. That way, when the location is changed, it will trigger the > refresh of that route. > > At this point, answering these questions gets more complicated depending > on what you've already done and how you did it. That said, it's pretty > likely that you'll be able to reduce the code you have by leveraging > ui-router with a single catch-all route and the function form of > `templateUrl` so that it pulls the html fragment from a URL that is based > on the url active in the browser. > > As far as your original request, I believe that as long as you don't have > a routing library installed (i.e. you're on 1.2+ and don't have ngRoute or > ui-router included on the page) using $location shouldn't actually cause > any problems. > > > On Thu, Jun 12, 2014 at 9:01 AM, hyperN <[email protected] > <javascript:>> wrote: > >> I'm doing the second thing :) >> >> "set up a route which matched all requests" -> on my server side or in >> Angular ? >> >> >> On Thursday, June 12, 2014 2:46:06 PM UTC+2, Chris Rhoden wrote: >> >>> I think I may be confused – when you say that you are using server-side >>> routing, does that mean you want to trigger a new request to the server and >>> re-render the page? If that's the case, you shouldn't be using pushState at >>> all, but the standard $window.location APIs. pushState will not trigger a >>> new request. >>> >>> If you're doing something fancier, like fetching data from the server >>> asynchronously and re-rendering it in the Angular app, it will be less work >>> to do that within the Angular routing systems (either ngRoute or ui-router) >>> which totally support you doing this with help from the server. You'd just >>> need to set up a route which matched all requests and then trigger the >>> appropriate async request to the server. >>> >>> >>> >>> On Thu, Jun 12, 2014 at 8:37 AM, hyperN <[email protected]> wrote: >>> >>>> Yes, because I manage routes using server side code, and if I do that >>>> than I would have to rewrite my routing and use Angular's, so this is >>>> solution is more convenient for me (as I plan to use this on only one page >>>> on my website) >>>> >>>> >>>> On Thursday, June 12, 2014 2:27:19 PM UTC+2, Chris Rhoden wrote: >>>> >>>>> Is there a reason you can't use the $location service with html5 mode >>>>> enabled? >>>>> >>>>> >>>>> On Thu, Jun 12, 2014 at 6:21 AM, hyperN <[email protected]> wrote: >>>>> >>>>>> I have problem using HTML 5 History API with Angular: >>>>>> >>>>>> Error: [$rootScope:infdig] 10 $digest() iterations reached. >>>>>> Aborting!Watchers fired in the last 5 iterations: [["fn: $locationWatch; >>>>>> newVal: 8; oldVal: 7"],["fn: $locationWatch; newVal: 9; oldVal: >>>>>> 8"],["fn: $locationWatch; newVal: 10; oldVal: 9"],["fn: $locationWatch; >>>>>> newVal: 11; oldVal: 10"],["fn: $locationWatch; newVal: 12; oldVal: 11"]] >>>>>> >>>>>> Then I've searched for solution and I've found out that this is known >>>>>> problem. Only "solution" I've managed to find, which worked, was >>>>>> wrapping >>>>>> history API inside setTimeout function, smth. like this: >>>>>> >>>>>> setTimeout(function() { >>>>>> history.pushState({}, "progress", url); >>>>>> },1000); >>>>>> >>>>>> One user mentioned that this worked for him also: >>>>>> >>>>>> $browser.url( state.url ); >>>>>> history.replaceState({}, state.title, state.url ); >>>>>> >>>>>> But no luck for me. $browser is Angular's private API which $location >>>>>> uses, interesting thing is that if I do smth. like this: >>>>>> >>>>>> var url = $browser.url() + "/progress"; >>>>>> $browser.url(url,true); >>>>>> console.log(window.location.href); >>>>>> >>>>>> My new url is logged but I don't see changes in address bar i.e. >>>>>> $browser.url() is shown. (in Chorme this proggres is shown for brief >>>>>> second >>>>>> then it disappears) >>>>>> >>>>>> Could this be due to my server side routing configuration ? (I'm >>>>>> using ASP.net <http://asp.net/> MVC). >>>>>> >>>>>> My question is, has anyone alse had any luck with $browser or found >>>>>> solution to this problem other than setTimeout ? >>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "AngularJS" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to [email protected]. >>>>>> To post to this group, send email to [email protected]. >>>>>> >>>>>> Visit this group at http://groups.google.com/group/angular. >>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> chrisrhoden >>>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "AngularJS" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To post to this group, send email to [email protected]. >>>> Visit this group at http://groups.google.com/group/angular. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> >>> >>> -- >>> chrisrhoden >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "AngularJS" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at http://groups.google.com/group/angular. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > chrisrhoden >
-- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
