Unable to view descriptions of generated docs

132 views Asked by At

although I'm able to serve from filesystem the grunt-ngdocs automatically generated index.html, everytime I try to look to a description in the documentation I'm getting:

XMLHttpRequest cannot load file:///C:/<file-path> Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource

even if both the docs/partials and docs/partials/api folders are empty.

This is my grunt-ngdocs configuration

ngdocs: {
       options: {
           dest: 'docs',
           html5Mode: false,
           inlinePartials: true,
           scripts: [
               'bower_components/angular/angular.js',
               'bower_components/angular-animate/angular-animate.js'
           ]
       },
       api: {
           src: ['app/scripts/**/*.js'],
           title: 'Docs'
       }
    }

What am I doing wrong?

Thank you in advance

1

There are 1 answers

6
andreboekhorst On

Problem is you have to run it from a server. I use a node http server (https://www.npmjs.com/package/http-server). After installing it, just head into the docs/ directory and type 'http-server'. You will get the following message:

Starting up http-server, serving ./ on: http://0.0.0.0:8080

You can now check the docs on the given URL (http://0.0.0.0:8080)

Edit:

If you don't want to load it from a server, you can set the option inlinePartials to true in the gruntfile. This is what I have:

ngdocs: {
    options: {
        dest: 'docs', 
        title: "Docs",
        inlinePartials: true
    },
    api: {
      src: ['<%= yeoman.app %>/scripts/**/*.js'],
      title: 'API Documentation'
    }
},

see (https://github.com/m7r/grunt-ngdocs)