I'm trying to build an angular module that uses a json file as a data source.
I am able to build using gulp a set of app.js / app.css files that can then be used by bower to create an installable module, I am stuck on how to include / reference this json file
so, I have a module defined as this (pseudo code)
(function() {
'use strict';
angular
.module('myFoo', ['ngResource']);
.service('myService',myService);
/** @ngInject */
function myService($resource) {
return $resource('somefile.json');
}
})();
I can now build this module, make it available via bower, then "bower install" this module, into my app, inject it and use it - unfortunately, I get a
https://myServer/somefile.json 404 (Not Found)
how do I embed / include this json file into a build that can be referenced this way ?
If I modify the service to return data directly, then it works as expected.
I was going to go down the route of gulp-injecting the contents into the service file directly if there is no better option.
Would appreciate any insights. Thanks!