Angular JS not working with IE9 but works with other browsers

后端 未结 2 655
眼角桃花
眼角桃花 2020-12-10 09:24

So I am working on a small app that gets that from an API url like so... $http.get(s_url) .then(function(res) {... My app works well with chrome,safari,opera

相关标签:
2条回答
  • 2020-12-10 09:50

    Try prefixing ng-app and ng-view with data as in data-ng-app, data-ng-view.

    0 讨论(0)
  • 2020-12-10 09:50

    I had a similar issue. The page would load properly, calling angular to populate a table. subsequent clicks on a refresh button should recall the fetching method, but were ignored by the browser.

    The resolution was to add content expiry headers expiring 5 seconds in the past, and then IE would execute the Angular scripts.

    EDIT:

    How to implement

    The headers to add are specified in the HTTP specification.

    I have printed a fixed timestamp here. You can of course set the date explicitly using date/time functions

    Depending on which language you are using, and which webserver yuo are hosted on, there are different ways to do this:

    .htaccess file:

    <filesMatch "\.json">
       Header set Cache-Control "max-age=0, public"
       Header set Expires "Thu, 01 Dec 1994 16:00:00 GMT"
    </filesMatch>
    

    -note both shouldn't be necessary

    if you are using php:

    <? header("Expires: Thu, 01 Dec 1994 16:00:00 GMT");
       header("Cache-Control: max-age=0, public");  
    ?>
    

    if you are using jsp:

    <% 
       response.setHeader("Cache-Control: max-age=0, public");
    %>
    
    0 讨论(0)
提交回复
热议问题