Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Angular.js 1.3-rc0 HTML5 Location and base tags #8866

Closed

Description

@billxinli

Recently bumped Angular.js to latest 1.3-rc0 release.

Project is using ui-router with HTML5 location mode set to true.

Added the <base> tag inside of the <html> tag. Like so:

<head>
  <base href="/">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <link href='/css/vendor.css' type='text/css' media='all' rel='stylesheet'>
  <link href='/css/application.css' type='text/css' media='all' rel='stylesheet'>
  <script src="/js/vendor.js" type="text/javascript"></script>
  <script src="/js/templatescache.js" type="text/javascript"></script>
</head>

The routing is defined as:

  $locationProvider.html5Mode(true)
  $urlRouterProvider.otherwise('/')
  $stateProvider....

However, in Karma test I am seeing:

  Error: [$location:nobase] $location in HTML5 mode requires a <base> tag to be present!
  http://errors.angularjs.org/1.3.0-rc.0/$location/nobase
      at /code/project/public/js/vendor.js:57677
      at invoke (/code/project/public/js/vendor.js:51462)
      at /code/project/public/js/vendor.js:51294
      at getService (/code/project/public/js/vendor.js:51421)
      at invoke (/code/project/public/js/vendor.js:51453)
      at /code/project/public/js/vendor.js:51294
      at getService (/code/project/public/js/vendor.js:51421)
      at invoke (/code/project/public/js/vendor.js:51453)
      at /code/project/public/js/vendor.js:51294
      at getService (/code/project/public/js/vendor.js:51421)
      at invoke (/code/project/public/js/vendor.js:51453)
      at /code/project/public/js/vendor.js:51298
      at forEach (/code/project/public/js/vendor.js:47695)
      at createInjector (/code/project/public/js/vendor.js:51298)
      at workFn (/code/project/bower_components/angular-mocks/angular-mocks.js:2226)
PhantomJS 1.9.7 (Mac OS X): Executed 9 of 47 (9 FAILED) ERROR (0.016 secs / 0.078 secs)

Activity

  1. IgorMinar commented on Aug 30, 2014

    @IgorMinar
    Contributor

    @tbosch, I think that we need to make sure that the mock has a default base url set to /

  2. added this to the milestone on Aug 30, 2014
  3. reopened this on Sep 2, 2014
  4. caitp commented on Sep 2, 2014

    @caitp
    Contributor

    accident! carry on.

  5. tbosch commented on Sep 2, 2014

    @tbosch
    Contributor

    Yes, will work on this today

  6. added a commit that references this issue on Sep 2, 2014
    607708e
  7. tysonnero commented on Sep 12, 2014

    @tysonnero

    I've upgraded to v1.3.0-rc.1, however I am still seeing the exact same issue as @billxinli.

  8. caitp commented on Sep 12, 2014

    @caitp
    Contributor

    @tysonnero did you upgrade both angular-mocks and angular? (a frequent occurrence lately seems to be people reporting bugs caused by using mismatched versions of angular-mocks and angular, which is why I ask)

  9. ghoullier commented on Sep 13, 2014

    @ghoullier

    I'v the same problem as @tysonnero and @billxinli. Reproduced with rc-0 and rc-1, not reproduced in beta-19.

  10. tysonnero commented on Sep 15, 2014

    @tysonnero

    @caitp - I did upgrade angular, angular-mocks, and all other angular libs. I opened each file to double check the version was 1.3.0-rc.1. I retried the upgrade this morning on a different box to no avail. But perhaps I'm doing something wrong.

  11. billxinli commented on Sep 15, 2014

    @billxinli
    Author

    When the Angular.js team fixed the mock location issue, we just bumped angular-mock to master.

    "angular-mocks": "[email protected]:twg/bower-angular-mocks.git#master"
    

    which made all of our tests passing again.

  12. Awk34 commented on Nov 12, 2014

    @Awk34

    Thanks guys, I had the same issue, forgot to bump angular-mocks to 1.3

  13. johnpapa commented on Nov 21, 2014

    @johnpapa
    Contributor

    appears to be fixed in 1.2.26, too. thanks

  14. bperel commented on Jun 15, 2015

    @bperel

    I don't see this fixed on 1.2.x : angular-mocks.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions