Приложение в PLUNK
Файл
index.html:
<!DOCTYPE html>
<html lang="en" ng-app="app">
<head>
<meta charset="utf-8" />
<title>AngularJS - Getting Started!</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/5.0.2/css/foundation.min.css">
</head>
<body>
<div class="row">
<h1 class="text-center">AngularJS - Getting Started</h1>
</div>
<ng-view></ng-view>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.5/angular-route.min.js"></script>
<script type="text/javascript" src="app.js"></script>
</body>
</html>
Файл
login.html:
<form>
<div class="row">
<div class="small-6 large-centered columns columns">
<input type="text" placeholder="Login" />
</div>
<div class="small-6 large-centered columns columns">
<input type="password" placeholder="Password" />
</div>
<div class="small-6 large-centered columns columns">
<button class="button">Log-In</button>
</div>
</div>
</form>
Файл
app.js:
var app = angular.module('app', ['ngRoute']).config(function ($routeProvider) {
$routeProvider.when('/login', {
templateUrl: "login.html",
controller: 'LoginController'
});
$routeProvider.otherwise({ redirectTo: 'login' });
});
app.controller('LoginController', function ($scope) {
});
Ошибки:
XMLHttpRequest cannot load file:///C:/Users/Adminchic/Desktop/Angular.js/login.html. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
Error: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'file:///C:/Users/Adminchic/Desktop/Angular.js/login.html'.