简体   繁体   中英

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!

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"}]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM