私はw3schoolsのチュートリアルを行っていますが、そのスニペットの1つをコピーしました。ブラウザでページを表示しようとすると、読み込むのに30分かかります。また、機能は単に機能していません。このコードはw3schoolsでのみ動作するようです。彼らはcdnを提供しています(古いですが、まだ動作するはずです)。どんな支援も大歓迎です。ページは、GoogleのCDNからの角度のコアをダウンロードする必要があるとしてAngularjsが動作しないとページの読み込みが遅すぎる
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-route.js"></script>
<body ng-app="myApp">
<p><a href="#/">Main</a></p>
<a href="#banana">Banana</a>
<a href="#tomato">Tomato</a>
<p>Click on the links to change the content.</p>
<p>The HTML shown in the ng-view directive are written in the template property of the $routeProvider.when method.</p>
<div ng-view></div>
<script>
var app = angular.module("myApp", ["ngRoute"]);
app.config(function($routeProvider) {
$routeProvider
.when("/", {
template : "<h1>Main</h1><p>Click on the links to change this content</p>"
})
.when("/banana", {
template : "<h1>Banana</h1><p>Bananas contain around 75% water.</p>"
})
.when("/tomato", {
template : "<h1>Tomato</h1><p>Tomatoes contain around 95% water.</p>"
});
});
</script>
</body>
</html>
正式な角のウェブサイトに従うことをお勧めします。彼らは素晴らしいチュートリアルを持っています。 – abhishekkannojia
ありがとうございました。 :) – thetekkenmaster
'ngRoute'スクリプトのインクルードがありませんhttps: – Laazo