cunisia
cunisia

Reputation: 140

Where to put ng1 templates in an angular hybrid application built by angular-cli?

I'm trying to build an angular hybrid application out of a angular.js application. I'm following the official documentation (https://angular.io/guide/upgrade). I reached and completed this step: https://angular.io/guide/upgrade#bootstrapping-hybrid-applications.

I'm using angular ui-router 0.3.1 to handle the routing of my application. Therefore, using the config function on my main module, and the $stateProvider service, I've mapped each route to an angular.js controller and a template specified by the templateUrl parameter.

My application seems to startup correctly but the templates cannot be loaded because they cannot be found (404 error). This is normal because they are not imported in the dist folder where my application is built when I use the ng build angular-cli command line.

How can I configure my application so that my angular.js html templates get copied in the dist folder when my angluar application is built by angular-cli?

Thanks in advance!

Upvotes: 0

Views: 951

Answers (1)

cunisia
cunisia

Reputation: 140

So actually it appears my question was a duplicate of that one: Angular CLI with Hybrid app ng-build.

The idea is to use the assets array from angular-cli.json. Glob enables to select recursively all html files from the folder of your choice and to put them in a subfolder of dist: "asssets": [{"glob": "**/*.html", "input": "../src-ng1", "output": "./src-ng1"}]

Upvotes: 0

Related Questions