either way, you will need to accommodate that hashbang conversion for ie9
if no polyfil is put in place for history. So I would just redirect to root
path and append hashbang version of url.




----------------------------

*Alesei Narkevitch* / [email protected] / *224.392.2592*



linkedin.com/in/aleseinarkevitch

github.com/gnrlbzik

twitter.com/gnrlbzik

stackoverflow.com/users/201244/gnrlbzik

forrst.me/gnrlbzik/posts

coderwall.com/gnrlbzik

coderbits.com/gnrlbzik


On Tue, Apr 29, 2014 at 3:08 PM, Yale Kaul <[email protected]> wrote:

> re: history.js... Yes, I was briefly considering that, but I imagined that
> I would have to monkeypatch Angular in order to make it work
>
>
> On Tuesday, April 29, 2014 12:41:32 PM UTC-7, Alesei N wrote:
>
>> so to fix that, you need to convert this route for ie9 into
>> domain.com/#!/v2/challenges/new from domain.com/v2/challenges/new.
>>
>> you could also may be look into polyfil https://github.com/
>> browserstate/history.js/ might be something that you can work around.
>>
>>
>>
>> On Tue, Apr 29, 2014 at 12:30 PM, Yale Kaul <[email protected]> wrote:
>>
>>> That is correct.
>>>
>>> On Monday, April 28, 2014 8:38:14 PM UTC-7, Alesei N wrote:
>>>>
>>>>  correct me if I am wrong, if you load */v2/challenges/new* in ie9,
>>>> you get base route resolution in angular app right? instead of
>>>> */v2/challenges/new* you get default page loaded right?
>>>>
>>>>
>>>> On Mon, Apr 28, 2014 at 9:20 PM, Yale Kaul <[email protected]> wrote:
>>>>
>>>>> That mostly makes sense to me.
>>>>>
>>>>> The part I'm still confused about is 1.2.
>>>>>
>>>>> I'm able to make the server redirect to */#/v2/challenges/new* for
>>>>> IE9, but how will Angular know to do the same thing at
>>>>> */#/v2/challenges/new* and */v2/challenges/new* (no hashbang)?
>>>>>
>>>>> In other words, I load */v2/challenges/new* in Chrome and serve the
>>>>> index route, which has all my Angular routes set up. One of those routes 
>>>>> is:
>>>>>
>>>>> $routeProvider
>>>>>         .when('/v2/challenges/new', {
>>>>>             templateUrl: '/assets/templates/new.html',
>>>>>             controller: 'BuildController'
>>>>>
>>>>> ... so Angular correctly loads the correct controller and template.
>>>>>
>>>>> But if I load* /v2/challenges/new* in IE9, and then I configure Rails
>>>>> to redirect to* /#/v2/challenges/new, *what should happen then? I
>>>>> realize that answer is probably fairly specific to my app, but maybe
>>>>> there's a  general answer.
>>>>>
>>>>> Again, I really appreciate your help so far. This is super confusing
>>>>> to me.
>>>>>
>>>>> (Sorry for the odd delay; had to step away from this problem for a few
>>>>> days)
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Thursday, April 24, 2014 12:36:16 PM UTC-7, Alesei N wrote:
>>>>>>
>>>>>>  I think this should make it bit more clear:
>>>>>> 1) User enters site at /v2/challenges/new
>>>>>>    1.1) default: browser that supports html5 history would then serve
>>>>>> index view from that route, index view has all the references to JS/CSS.
>>>>>> Angular app loads, sees its at /v2/challenges/new and does what it
>>>>>> needs to do for that route.
>>>>>>    1.2) user agent is ie9: you would have to redirect them to root of
>>>>>> domain.com plus appending this route to it via hash bang domain.com/#
>>>>>> /v2/challenges/new. So at the end you actually redirecting to
>>>>>> domain.com/#/v2/challenges/new.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Thu, Apr 24, 2014 at 11:15 AM, Yale Kaul <[email protected]>wrote:
>>>>>>
>>>>>>> Thanks so much for your reply, Alesei.
>>>>>>>
>>>>>>> So if I'm understanding you correctly, the flow for an IE9 visitor
>>>>>>> is this:
>>>>>>>
>>>>>>> 1. User loads /v2/challenges/new,
>>>>>>> 2. Angular rewrites to /#!/v2/challenges/new
>>>>>>> 3. Browser ignores everything after #, and loads '/'
>>>>>>> 4. Server serves up '/', which must have references to Angular
>>>>>>> scripts
>>>>>>> --
>>>>>>> 5. This is the part I'm still not understanding. Once I get to the
>>>>>>> root route, the Angular router takes over? How does it differentiate
>>>>>>> between someone requesting /#!/v2/challenges/new  and someone
>>>>>>> requesting root route?
>>>>>>>
>>>>>>> Thanks again!
>>>>>>>
>>>>>>>
>>>>>>> On Thursday, April 24, 2014 6:02:36 AM UTC-7, Alesei N wrote:
>>>>>>>>
>>>>>>>> it means, all the routes that you have set up in your SPA, should
>>>>>>>> have corresponding Rails routes. So when you are hitting that route
>>>>>>>> directly in browser, your rails app can serve html that has references 
>>>>>>>> to
>>>>>>>> your angular app javascript and styles.
>>>>>>>>
>>>>>>>> In case of hash bang and ie9 it depends how far you want to go,
>>>>>>>> your root route, should serve mark up that has references to 
>>>>>>>> javascript and
>>>>>>>> styles, so once app loads it can react to /#!/v2/challenges/new.
>>>>>>>> There are other things you can do, for example if some one comes from
>>>>>>>> normal url from search, but user agent is ie9, you could redirect to 
>>>>>>>> root
>>>>>>>> with hash bang equivalent of that route.
>>>>>>>>
>>>>>>>>
>>>>>>>> On Wednesday, April 23, 2014 3:54:44 PM UTC-5, Yale Kaul wrote:
>>>>>>>>>
>>>>>>>>>  I've been working on an AngularJS/Rails app that must support
>>>>>>>>> IE9. From what I've read, I should set html5Mode to true in my 
>>>>>>>>> AngularJS
>>>>>>>>> config, which will use the HTML5 History API for browsers that 
>>>>>>>>> support it,
>>>>>>>>> and fall back to hashbang URLs for older browsers. All of the Angular 
>>>>>>>>> stuff
>>>>>>>>> in my app is rooted at */v2/challenges/.*
>>>>>>>>>
>>>>>>>>> In the fantastic ng-book <https://www.ng-book.com/>, it says:
>>>>>>>>>
>>>>>>>>> "The back-end server will have to support URL rewriting on the
>>>>>>>>> server side. To support HTML5 mode, the server will have to make sure 
>>>>>>>>> to
>>>>>>>>> deliver the index.html page for all apps. That ensures that our 
>>>>>>>>> Angular app
>>>>>>>>> will handle the route."
>>>>>>>>>
>>>>>>>>> What does that mean specifically?
>>>>>>>>>
>>>>>>>>> If my AngularJS content is at /v2/challenges/new (which appears as
>>>>>>>>>  /#!/v2/challenges/new in IE9),
>>>>>>>>>
>>>>>>>>> ...what does that mean for me in terms of the URL rewriting I need
>>>>>>>>> to do on the server side?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Thanks!
>>>>>>>>>
>>>>>>>>  --
>>>>>>> You received this message because you are subscribed to a topic in
>>>>>>> the Google Groups "AngularJS" group.
>>>>>>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>>>>>>> pic/angular/0cFJSAi68xw/unsubscribe.
>>>>>>> To unsubscribe from this group and all its topics, 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.
>>>>>>>
>>>>>>
>>>>>>  --
>>>>> You received this message because you are subscribed to a topic in the
>>>>> Google Groups "AngularJS" group.
>>>>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>>>>> pic/angular/0cFJSAi68xw/unsubscribe.
>>>>> To unsubscribe from this group and all its topics, 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.
>>>>>
>>>>
>>>>  --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "AngularJS" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/
>>> topic/angular/0cFJSAi68xw/unsubscribe.
>>> To unsubscribe from this group and all its topics, 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.
>>>
>>
>>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "AngularJS" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/angular/0cFJSAi68xw/unsubscribe.
> To unsubscribe from this group and all its topics, 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.
>

-- 
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.

Reply via email to