Angular version
angular 1.6.9
Angular route version
angular-route 1.6.9
Parcel version
parcel-bundler 1.6.1
Hey! I'm writing this issue tonight because i've experienced some errors with Angular 1.6.9 routing and Parcel Bundler.
I'm not sure if this issue is related to Angular or Parcel, but feel free to take me back to the right way if i'm wrong.
As a developer, I like to split each blocks of code in separate files for better organization and since I don't like configuration, Parcel seems to be something I'll use a lot.
Here's my router.js file:
export default function routing($routeProvider, $locationProvider) {
$routeProvider
.when('/', {
controller: 'HomeCtrl'
})
.otherwise({redirectTo: '/'})
$locationProvider.html5Mode(true);
}
Inside a route, I have to specify which template or templateUrl to use. I've tried many ways to do this because if I specify a templateUrl like this ../pages/home.html my application instantly crash.
However, if I use instead a simple template: key and enter something like this: require('../pages/home.html) it doesn't work.
I've made some researches and found nothing about that issue. That's why i'm not sure if its related to AngularJS or Parcel.
The only way to make it work is to create a home.js file and to export it:
export default `
<h1>asdasdasd</h1>
<p>Test routing on / {{message}}</p>
`
I personnaly don't think that this is the best way to do that. Let me know if you have any informations about that. I may provide more details if needed.
Thanks!
EDIT: Sorry for my bad english!
Angular version
angular 1.6.9
Angular route version
angular-route 1.6.9
Parcel version
parcel-bundler 1.6.1
Hey! I'm writing this issue tonight because i've experienced some errors with Angular 1.6.9 routing and Parcel Bundler.
I'm not sure if this issue is related to Angular or Parcel, but feel free to take me back to the right way if i'm wrong.
As a developer, I like to split each blocks of code in separate files for better organization and since I don't like configuration, Parcel seems to be something I'll use a lot.
Here's my router.js file:
Inside a route, I have to specify which template or templateUrl to use. I've tried many ways to do this because if I specify a templateUrl like this
../pages/home.htmlmy application instantly crash.However, if I use instead a simple
template:key and enter something like this:require('../pages/home.html)it doesn't work.I've made some researches and found nothing about that issue. That's why i'm not sure if its related to AngularJS or Parcel.
The only way to make it work is to create a
home.jsfile and to export it:I personnaly don't think that this is the best way to do that. Let me know if you have any informations about that. I may provide more details if needed.
Thanks!
EDIT: Sorry for my bad english!