Saturday, 15 August 2015

javascript - Angular Partials: templateUrl Routing Local .HTML File -



javascript - Angular Partials: templateUrl Routing Local .HTML File -

i've had problem on 2 days , i've spent around 10 hours researching, nil has worked far. i'm keeping stress levels in check, downright infuriating!

this jsfiddle has aside "page1.html" file i'm trying load

http://jsfiddle.net/tamr3/

i want load sibling (same directory), page1.html file such:

var playground = angular.module("playground",['ngroute']) .config(function($routeprovider){ $routeprovider.when('/page1', { templateurl: 'page1.html', // **this line not work** controller:'page1ctrl' }).otherwise({redirectto:'/'}) });

the problem "templateurl" refuses work!!!

the $routeprovider knows when i'm trying access page1 because page1ctrl console.logging successfully

the problem here serving angular app on file:// , having angular trigger cross-origin request when tried fetch template on http://.

the easiest solution utilize webserver rather accessing file-system directly.

javascript angularjs templates routing partials

No comments:

Post a Comment