<!DOCTYPE html>
<html>
<head>
<script data-require="angular.js@1.0.7" data-semver="1.0.7" src="http://code.angularjs.org/1.0.7/angular.min.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body ng-app="MyApp">
<h1>Hello Plunker!</h1>
<div ng-view></div>
</body>
</html>
// Code goes here
var app = angular.module('MyApp',[]);
app.config(function ($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'home.html',
controller: 'HomeCtrl'
});
});
app.run(function ($rootScope,$location){
$rootScope.$on('$routeChangeStart',function(event,next,current){
//console.log($location.host()) results in 'run.plnkr.co'
// plunker refused to save my example if the file has / so uncomment
// the below for your use
//next.templateUrl = "views/"+$location.host()+"/"+next.templateUrl;
// for plunker use only: i use _ instead of / to demo directories
next.templateUrl = "views_"+$location.host()+"_"+next.templateUrl;
});
});
app.controller('HomeCtrl',function($scope){
// controller implementation here
});
/* Styles go here */
Hi Plunker Users