{"id":499,"date":"2023-08-02T03:36:24","date_gmt":"2023-03-20T06:19:27","guid":{"rendered":"https:\/\/www.silicloud.com\/ja\/blog\/index.php\/2023\/11\/30\/angularjs%e3%81%ae%e3%83%ab%e3%83%bc%e3%83%86%e3%82%a3%e3%83%b3%e3%82%b0%e3%81%ae%e4%be%8b-ngroute%e3%80%81routeprovider\/"},"modified":"2025-08-01T00:03:35","modified_gmt":"2025-07-31T15:03:35","slug":"angularjs%e3%81%ae%e3%83%ab%e3%83%bc%e3%83%86%e3%82%a3%e3%83%b3%e3%82%b0%e3%81%ae%e4%be%8b-ngroute%e3%80%81routeprovider","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/ja\/blog\/angularjs%e3%81%ae%e3%83%ab%e3%83%bc%e3%83%86%e3%82%a3%e3%83%b3%e3%82%b0%e3%81%ae%e4%be%8b-ngroute%e3%80%81routeprovider\/","title":{"rendered":"AngularJS\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u4f8b &#8211; ngRoute\u3001$routeProvider"},"content":{"rendered":"<p>\u4eca\u65e5\u306f\u3001ngRoute\u30e2\u30b8\u30e5\u30fc\u30eb\u3068$routeProvider\u3092\u4f7f\u7528\u3057\u305fAngularJS\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u4f8b\u3092\u898b\u3066\u3044\u304d\u307e\u3059\u3002\u4ee5\u524d\u306f\u3001AngularJS\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u3068\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306b\u3064\u3044\u3066\u898b\u3066\u3044\u304d\u307e\u3057\u305f\u3002<\/p>\n<h2>AngularJS\u306b\u304a\u3051\u308b\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0<\/h2>\n<p>AngularJS\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306f\u3001\u30b3\u30a2\u6a5f\u80fd\u306e1\u3064\u3067\u3059\u3002\u3053\u306eAngularJS\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u4f8b\u3067\u306f\u3001\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u304c\u3069\u306e\u3088\u3046\u306b\u6a5f\u80fd\u3059\u308b\u304b\u3092\u793a\u3059\u305f\u3081\u306b\u3001\u8907\u6570\u306e\u30d3\u30e5\u30fc\u3092\u6301\u3064\u5c0f\u3055\u306a\u30b7\u30f3\u30b0\u30eb\u30da\u30fc\u30b8\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<h3>ngRoute \u4f8b<\/h3>\n<p>AngularJS\u306engRoute\u30e2\u30b8\u30e5\u30fc\u30eb\u306f\u3001Angular\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u3068\u30c7\u30a3\u30fc\u30d7\u30ea\u30f3\u30ad\u30f3\u30b0\u306e\u305f\u3081\u306e\u30b5\u30fc\u30d3\u30b9\u3068\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u6a5f\u80fd\u3092\u4f7f\u7528\u3059\u308b\u305f\u3081\u306b\u306f\u3001AngularJS\u516c\u5f0f\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u304b\u3089ngRoute\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u542b\u3080angular-route.js\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u542b\u3081\u308b\u305f\u3081\u306b\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5185\u3067CDN\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001Google\u306eCDN\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002https:\/\/ajax.googleapis.com\/ajax\/libs\/angularjs\/1.2.28\/\/angular-route.min.js \u3082\u3057\u3001\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u30d0\u30f3\u30c9\u30eb\u3057\u305f\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u30da\u30fc\u30b8\u306b\u8ffd\u52a0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>&lt;script src=\"angular-route.js\"&gt;\r\n<\/code><\/pre>\n<p>\u3082\u3057Google CDN\u304b\u3089\u305d\u308c\u3092\u542b\u3081\u305f\u3044\u306e\u3067\u3042\u308c\u3070\u3001\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u4f7f\u7528\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code>&lt;script src=\"https:\/\/ajax.googleapis.com\/ajax\/libs\/angularjs\/1.2.28\/\/angular-route.min.js\"&gt;&lt;\/script&gt;\r\n<\/code><\/pre>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3001\u4f9d\u5b58\u30e2\u30b8\u30e5\u30fc\u30eb\u3068\u3057\u3066ngRoute\u30e2\u30b8\u30e5\u30fc\u30eb\u3092AngularJS\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u30ed\u30fc\u30c9\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code>angular.module('appName', ['ngRoute']);\r\n<\/code><\/pre>\n<h3>ngView (\u30a8\u30f3\u30b8\u30fc\u30d3\u30e5\u30fc)<\/h3>\n<p>ngView\u30c7\u30a3\u30ec\u30af\u30c6\u30a3\u30d6\u306f\u3001\u6307\u5b9a\u3055\u308c\u305f\u30eb\u30fc\u30c8\u5185\u306bHTML\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u307e\u305f\u306f\u30d3\u30e5\u30fc\u3092\u8868\u793a\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002\u73fe\u5728\u306e\u30eb\u30fc\u30c8\u304c\u5909\u66f4\u3055\u308c\u308b\u5ea6\u306b\u3001$route\u30b5\u30fc\u30d3\u30b9\u306e\u8a2d\u5b9a\u306b\u5f93\u3063\u3066\u542b\u307e\u308c\u308b\u30d3\u30e5\u30fc\u3082\u5909\u66f4\u3055\u308c\u307e\u3059\u3002<\/p>\n<h3>\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u30fb\u30d7\u30ed\u30d0\u30a4\u30c0\u30fc<\/h3>\n<p>$routeProvider\u306f\u30eb\u30fc\u30c8\u3092\u8a2d\u5b9a\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002\u79c1\u305f\u3061\u306fngRoute\u306econfig\uff08\uff09\u3092\u4f7f\u7528\u3057\u3066$routeProvider\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002config\uff08\uff09\u306f\u3001$routeProvider\u3092\u5f15\u6570\u306b\u53d6\u308b\u95a2\u6570\u3092\u53d6\u308a\u307e\u3059\u3002\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u8a2d\u5b9a\u306f\u95a2\u6570\u306e\u5185\u90e8\u306b\u914d\u7f6e\u3055\u308c\u307e\u3059\u3002$routeProvider\u306f\u30b7\u30f3\u30d7\u30eb\u306aAPI\u3092\u6301\u3063\u3066\u304a\u308a\u3001when\uff08\uff09\u307e\u305f\u306fotherwise\uff08\uff09\u30e1\u30bd\u30c3\u30c9\u3092\u53d7\u3051\u5165\u308c\u307e\u3059\u3002<\/p>\n<h3>AngularJS\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u69cb\u6587<\/h3>\n<p>AngularJS\u3067\u30eb\u30fc\u30c8\u3092\u8a2d\u5b9a\u3059\u308b\u305f\u3081\u306b\u306f\u3001\u6b21\u306e\u69cb\u6587\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>var app = angular.module(\"appName\", ['ngRoute']);\r\n\r\napp.config(function($routeProvider) {\r\n\t$routeProvider\r\n\t\t.when('\/view1', {\r\n\t\t\ttemplateUrl: 'view1.html',\r\n\t\t\tcontroller: 'FirstController'\r\n\t\t})\r\n\t\t.when('\/view2', {\r\n\t\t\ttemplateUrl: 'view2.html',\r\n\t\t\tcontroller: 'SecondController'\r\n\t\t})\r\n\t\t.otherwise({\r\n\t\t\tredirectTo: '\/view1'\r\n\t\t});\r\n});\r\n<\/code><\/pre>\n<p>when()\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u30d1\u30b9\u3068\u30eb\u30fc\u30c8\u3092\u30d1\u30e9\u30e1\u30fc\u30bf\u3068\u3057\u3066\u53d7\u3051\u53d6\u308a\u307e\u3059\u3002\u30d1\u30b9\u306f#\u8a18\u53f7\u306e\u5f8c\u306eURL\u306e\u4e00\u90e8\u3067\u3059\u3002\u30eb\u30fc\u30c8\u306b\u306f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8URL\u3068\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u306e2\u3064\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8URL\u30d7\u30ed\u30d1\u30c6\u30a3\u306f\u3001AngularJS\u304cngView\u6307\u4ee4\u306ediv\u5185\u306b\u8aad\u307f\u8fbc\u3093\u3067\u8868\u793a\u3059\u308bHTML\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u5b9a\u7fa9\u3057\u307e\u3059\u3002\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30d7\u30ed\u30d1\u30c6\u30a3\u306f\u3001HTML\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306b\u4f7f\u7528\u3059\u308b\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3092\u5b9a\u7fa9\u3057\u307e\u3059\u3002\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u30ed\u30fc\u30c9\u3055\u308c\u308b\u3068\u3001\u30d1\u30b9\u306f#\u8a18\u53f7\u306e\u5f8c\u306eURL\u306e\u4e00\u90e8\u3068\u4e00\u81f4\u3057\u307e\u3059\u3002\u6307\u5b9a\u3055\u308c\u305fURL\u306b\u4e00\u81f4\u3059\u308b\u30eb\u30fc\u30c8\u30d1\u30b9\u304c\u306a\u3044\u5834\u5408\u3001\u30d6\u30e9\u30a6\u30b6\u306fotherwise()\u95a2\u6570\u3067\u6307\u5b9a\u3055\u308c\u305f\u30d1\u30b9\u306b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3055\u308c\u307e\u3059\u3002<\/p>\n<h2>AngularJS\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u4f8b<\/h2>\n<p>\u3055\u3042\u3001AngularJS\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u7406\u89e3\u306e\u305f\u3081\u306b\u7c21\u5358\u306a\u4f8b\u3092\u9032\u3081\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002\u307e\u305a\u6700\u521d\u306b\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u5b9a\u7fa9\u3057\u3001\u3044\u304f\u3064\u304b\u306e\u30eb\u30fc\u30c8\u3092\u4f5c\u6210\u3057\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u4f5c\u6210\u3057\u3001\u8907\u6570\u306e\u30d3\u30e5\u30fc\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u6700\u5f8c\u306b\u3001\u8907\u6570\u306e\u30d3\u30e5\u30fc\u3092\u4fdd\u6301\u3059\u308b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30b7\u30a7\u30eb\u30da\u30fc\u30b8\u3092\u4f5c\u6210\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>mainApp\u3068\u3044\u3046\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f5c\u6210\u3057\u3001ngRoute\u3092\u4f9d\u5b58\u30e2\u30b8\u30e5\u30fc\u30eb\u3068\u3057\u3066\u8aad\u307f\u8fbc\u3093\u3067\u304f\u3060\u3055\u3044\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>$routeProvider\u3092\u4f7f\u7528\u3057\u3066\u30eb\u30fc\u30c8\u3092\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u3053\u306e\u4f8b\u3067\u306f\u3001\/home\u3068\/viewStudents\u3068\u3044\u30462\u3064\u306e\u30d1\u30b9\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u3053\u306e\u4f8b\u3067\u306f\u30011\u3064\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3001StudentController\u306e\u307f\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>StudentController\u306f\u3001\u5b66\u751f\u306e\u914d\u5217\u3068\u30e1\u30c3\u30bb\u30fc\u30b8\u3067\u521d\u671f\u5316\u3055\u308c\u307e\u3059\u3002\u30e1\u30c3\u30bb\u30fc\u30b8\u306f\u30db\u30fc\u30e0\u30da\u30fc\u30b8\u306b\u8868\u793a\u3055\u308c\u3001\u5b66\u751f\u306e\u30ea\u30b9\u30c8\u306fviewStudents\u30da\u30fc\u30b8\u306b\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u3092main.js\u3068\u3057\u3066\u4fdd\u5b58\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/ol>\n<p>\u30e1\u30a4\u30f3\u306e.js\u30d5\u30a1\u30a4\u30eb<\/p>\n<pre class=\"post-pre\"><code>var mainApp = angular.module(\"mainApp\", ['ngRoute']);\r\n\r\nmainApp.config(function($routeProvider) {\r\n\t$routeProvider\r\n\t\t.when('\/home', {\r\n\t\t\ttemplateUrl: 'home.html',\r\n\t\t\tcontroller: 'StudentController'\r\n\t\t})\r\n\t\t.when('\/viewStudents', {\r\n\t\t\ttemplateUrl: 'viewStudents.html',\r\n\t\t\tcontroller: 'StudentController'\r\n\t\t})\r\n\t\t.otherwise({\r\n\t\t\tredirectTo: '\/home'\r\n\t\t});\r\n});\r\n\r\nmainApp.controller('StudentController', function($scope) {\r\n\t$scope.students = [\r\n\t\t{name: 'Mark Waugh', city:'New York'},\r\n\t\t{name: 'Steve Jonathan', city:'London'},\r\n\t\t{name: 'John Marcus', city:'Paris'}\r\n\t];\r\n\r\n\t$scope.message = \"Click on the hyper link to view the students list.\";\r\n});\r\n<\/code><\/pre>\n<p>\u305f\u3068\u3048\u3070\u3001URL\u304chttps:\/\/www.scdev.com\/index.html#\/home\u306e\u3088\u3046\u306a\u5834\u5408\u3001#\u306e\u5f8c\u306b\u3042\u308bURL\u90e8\u5206\u304c\/home\u3068\u4e00\u81f4\u3059\u308b\u3068\u3001home.html\u30da\u30fc\u30b8\u304c\u8aad\u307f\u8fbc\u307e\u308c\u307e\u3059\u3002\u305d\u3057\u3066\/viewStudents\u3068\u4e00\u81f4\u3059\u308b\u3068\u3001viewStudents.html\u304c\u30b7\u30a7\u30eb\u30da\u30fc\u30b8\u306b\u8aad\u307f\u8fbc\u307e\u308c\u307e\u3059\u3002\u4e00\u81f4\u3059\u308b\u3082\u306e\u304c\u306a\u3044\u5834\u5408\u3001\u305d\u308c\u4ee5\u5916\u306e\u6761\u4ef6\u306b\u5f93\u3063\u3066\u3001\u30da\u30fc\u30b8\u306fhome.html\u306b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3055\u308c\u307e\u3059\u3002\u3053\u308c\u3067\u3001home.html\u3068viewStudents.html\u306e\u30d3\u30e5\u30fc\u3092\u4f5c\u6210\u3057\u3066\u4fdd\u5b58\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>&lt;div class=\"container\"&gt;\r\n\t&lt;h2&gt; Welcome &lt;\/h2&gt;\r\n\t&lt;p&gt;{{message}}&lt;\/p&gt;\r\n\t&lt;a href=\"#\/viewStudents\"&gt; View Students List&lt;\/a&gt;\r\n&lt;\/div&gt;\r\n<\/code><\/pre>\n<p>\u5f53\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u30da\u30fc\u30b8\u3067\u3059\u3002\u3053\u306e\u30d3\u30e5\u30fc\u3067\u306f\u3001\u3059\u3067\u306bStudentController\u3067\u521d\u671f\u5316\u3055\u308c\u305f\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u5370\u5237\u3059\u308b\u3060\u3051\u3067\u3059\u3002\u307e\u305f\u3001viewStudents.html\u3078\u306e\u30ea\u30f3\u30af\u3082\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>&lt;div class=\"container\"&gt;\r\n\t&lt;h2&gt; View Students &lt;\/h2&gt;\r\n\tSearch:\r\n\t&lt;br\/&gt;\r\n\t\t&lt;input type=\"text\" ng-model=\"name\" \/&gt;\r\n\t&lt;br\/&gt;\r\n\t&lt;ul&gt;\r\n\t\t&lt;li ng-repeat=\"student in students | filter:name\"&gt;{{student.name}} , {{student.city}}&lt;\/li&gt;\r\n\t&lt;\/ul&gt;\r\n\r\n\t&lt;a href=\"#\/home\"&gt; Back&lt;\/a&gt;\r\n&lt;\/div&gt;\r\n<\/code><\/pre>\n<p>\u4e0a\u8a18\u306e\u30d3\u30e5\u30fc\u3067\u306f\u3001\u691c\u7d22\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u6301\u3064\u751f\u5f92\u306e\u30ea\u30b9\u30c8\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002\u6700\u5f8c\u306b\u3001AngularJS \u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u4f8b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u5b8c\u6210\u3055\u305b\u308b\u305f\u3081\u306b\u4ee5\u4e0b\u306e\u624b\u9806\u306b\u5f93\u3063\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<ul class=\"post-ul\">\n<li>ng-app\u00a0auto-bootstraps our application mainApp<\/li>\n<li>ngView directive is the placeholder of the views &#8211; home.html and viewStudents.html<\/li>\n<li>Include angular.min.js and angular-route.min.js<\/li>\n<li>Include main.js which we have created in the earlier steps.<\/li>\n<li>Save the file as index.html<\/li>\n<\/ul>\n<p>\u30a4\u30f3\u30c7\u30c3\u30af\u30b9.html<\/p>\n<pre class=\"post-pre\"><code>&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n\t&lt;head lang=\"en\"&gt;\r\n\t  &lt;meta charset=\"utf-8\"&gt;\r\n\t  &lt;title&gt;AngularJS Routing&lt;\/title&gt;\r\n\r\n\t&lt;\/head&gt;\r\n\t&lt;body&gt;\r\n\r\n\t  &lt;div ng-app=\"mainApp\"&gt;\r\n\t\t&lt;ng-view&gt;&lt;\/ng-view&gt;\r\n\t  &lt;\/div&gt;\r\n\r\n\t  &lt;script type=\"text\/javascript\" src=\"https:\/\/ajax.googleapis.com\/ajax\/libs\/angularjs\/1.2.28\/angular.min.js\"&gt;&lt;\/script&gt;\r\n\t  &lt;script type=\"text\/javascript\" src=\"https:\/\/ajax.googleapis.com\/ajax\/libs\/angularjs\/1.2.28\/\/angular-route.min.js\"&gt;&lt;\/script&gt;\r\n\t  &lt;script type=\"text\/javascript\" src=\"main.js\"&gt;&lt;\/script&gt;\r\n\t&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/code><\/pre>\n<p>\u79c1\u305f\u3061\u306eAngularJS\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u4f8b\u306f\u3053\u308c\u3067\u7d42\u308f\u308a\u3067\u3059\u3002\u79c1\u305f\u3061\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306f\u5b9f\u884c\u6e96\u5099\u304c\u3067\u304d\u3066\u3044\u307e\u3059\u3002<\/p>\n<h3>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u8d77\u52d5\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/h3>\n<ul class=\"post-ul\">\n<li>Save all the files in the same directory.<\/li>\n<li>open index.html from your browser<\/li>\n<li>Try our online demo.<\/li>\n<\/ul>\n<h3>AngularJS\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u4f8b\u3092\u30aa\u30f3\u30e9\u30a4\u30f3\u30c7\u30e2\u3067\u8868\u793a<\/h3>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u65e5\u306f\u3001ngRoute\u30e2\u30b8\u30e5\u30fc\u30eb\u3068$routeProvider\u3092\u4f7f\u7528\u3057\u305fAngularJS\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u4f8b\u3092\u898b\u3066\u3044\u304d\u307e\u3059\u3002\u4ee5\u524d\u306f\u3001AngularJS\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u3068\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306b\u3064\u3044\u3066\u898b\u3066\u3044\u304d\u307e\u3057\u305f\u3002 AngularJ [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[26,61],"class_list":["post-499","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-26","tag-61"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>AngularJS\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u4f8b - ngRoute\u3001$routeProvider - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"AngularJS\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u4f8b - ngRoute$routeProvider\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/ja\/blog\/angularjs\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u4f8b-ngroute\u3001routeprovider\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"AngularJS\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u4f8b - ngRoute\u3001$routeProvider\" \/>\n<meta property=\"og:description\" content=\"AngularJS\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u4f8b - ngRoute$routeProvider\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/ja\/blog\/angularjs\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u4f8b-ngroute\u3001routeprovider\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-03-20T06:19:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-31T15:03:35+00:00\" \/>\n<meta name=\"author\" content=\"\u6d77\u6597, \u8475\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u6d77\u6597, \u8475\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"12\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/angularjs%e3%81%ae%e3%83%ab%e3%83%bc%e3%83%86%e3%82%a3%e3%83%b3%e3%82%b0%e3%81%ae%e4%be%8b-ngroute%e3%80%81routeprovider\/\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/angularjs%e3%81%ae%e3%83%ab%e3%83%bc%e3%83%86%e3%82%a3%e3%83%b3%e3%82%b0%e3%81%ae%e4%be%8b-ngroute%e3%80%81routeprovider\/\",\"name\":\"AngularJS\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u4f8b - ngRoute\u3001$routeProvider - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\"},\"datePublished\":\"2023-03-20T06:19:27+00:00\",\"dateModified\":\"2025-07-31T15:03:35+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/20cfc053626f4d45c0fa7a4e7964b5b6\"},\"description\":\"AngularJS\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u4f8b - ngRoute$routeProvider\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/angularjs%e3%81%ae%e3%83%ab%e3%83%bc%e3%83%86%e3%82%a3%e3%83%b3%e3%82%b0%e3%81%ae%e4%be%8b-ngroute%e3%80%81routeprovider\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/ja\/blog\/angularjs%e3%81%ae%e3%83%ab%e3%83%bc%e3%83%86%e3%82%a3%e3%83%b3%e3%82%b0%e3%81%ae%e4%be%8b-ngroute%e3%80%81routeprovider\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/angularjs%e3%81%ae%e3%83%ab%e3%83%bc%e3%83%86%e3%82%a3%e3%83%b3%e3%82%b0%e3%81%ae%e4%be%8b-ngroute%e3%80%81routeprovider\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/ja\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"AngularJS\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u4f8b &#8211; ngRoute\u3001$routeProvider\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"ja\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/20cfc053626f4d45c0fa7a4e7964b5b6\",\"name\":\"\u6d77\u6597, \u8475\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/25aec9a18954b6bfb7e4f7219c2923d62c6f0c9f4d5c0171228fe41751c0ab7a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/25aec9a18954b6bfb7e4f7219c2923d62c6f0c9f4d5c0171228fe41751c0ab7a?s=96&d=mm&r=g\",\"caption\":\"\u6d77\u6597, \u8475\"},\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/author\/kaitoaoi\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/angularjs%e3%81%ae%e3%83%ab%e3%83%bc%e3%83%86%e3%82%a3%e3%83%b3%e3%82%b0%e3%81%ae%e4%be%8b-ngroute%e3%80%81routeprovider\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"AngularJS\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u4f8b - ngRoute\u3001$routeProvider - Blog - Silicon Cloud","description":"AngularJS\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u4f8b - ngRoute$routeProvider\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/ja\/blog\/angularjs\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u4f8b-ngroute\u3001routeprovider\/","og_locale":"ja_JP","og_type":"article","og_title":"AngularJS\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u4f8b - ngRoute\u3001$routeProvider","og_description":"AngularJS\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u4f8b - ngRoute$routeProvider\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","og_url":"https:\/\/www.silicloud.com\/ja\/blog\/angularjs\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u4f8b-ngroute\u3001routeprovider\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-03-20T06:19:27+00:00","article_modified_time":"2025-07-31T15:03:35+00:00","author":"\u6d77\u6597, \u8475","twitter_card":"summary_large_image","twitter_misc":{"\u57f7\u7b46\u8005":"\u6d77\u6597, \u8475","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"12\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/ja\/blog\/angularjs%e3%81%ae%e3%83%ab%e3%83%bc%e3%83%86%e3%82%a3%e3%83%b3%e3%82%b0%e3%81%ae%e4%be%8b-ngroute%e3%80%81routeprovider\/","url":"https:\/\/www.silicloud.com\/ja\/blog\/angularjs%e3%81%ae%e3%83%ab%e3%83%bc%e3%83%86%e3%82%a3%e3%83%b3%e3%82%b0%e3%81%ae%e4%be%8b-ngroute%e3%80%81routeprovider\/","name":"AngularJS\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u4f8b - ngRoute\u3001$routeProvider - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website"},"datePublished":"2023-03-20T06:19:27+00:00","dateModified":"2025-07-31T15:03:35+00:00","author":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/20cfc053626f4d45c0fa7a4e7964b5b6"},"description":"AngularJS\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u4f8b - ngRoute$routeProvider\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/angularjs%e3%81%ae%e3%83%ab%e3%83%bc%e3%83%86%e3%82%a3%e3%83%b3%e3%82%b0%e3%81%ae%e4%be%8b-ngroute%e3%80%81routeprovider\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/ja\/blog\/angularjs%e3%81%ae%e3%83%ab%e3%83%bc%e3%83%86%e3%82%a3%e3%83%b3%e3%82%b0%e3%81%ae%e4%be%8b-ngroute%e3%80%81routeprovider\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/ja\/blog\/angularjs%e3%81%ae%e3%83%ab%e3%83%bc%e3%83%86%e3%82%a3%e3%83%b3%e3%82%b0%e3%81%ae%e4%be%8b-ngroute%e3%80%81routeprovider\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/ja\/blog\/"},{"@type":"ListItem","position":2,"name":"AngularJS\u306e\u30eb\u30fc\u30c6\u30a3\u30f3\u30b0\u306e\u4f8b &#8211; ngRoute\u3001$routeProvider"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website","url":"https:\/\/www.silicloud.com\/ja\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"ja"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/20cfc053626f4d45c0fa7a4e7964b5b6","name":"\u6d77\u6597, \u8475","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/25aec9a18954b6bfb7e4f7219c2923d62c6f0c9f4d5c0171228fe41751c0ab7a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/25aec9a18954b6bfb7e4f7219c2923d62c6f0c9f4d5c0171228fe41751c0ab7a?s=96&d=mm&r=g","caption":"\u6d77\u6597, \u8475"},"url":"https:\/\/www.silicloud.com\/ja\/blog\/author\/kaitoaoi\/"},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/angularjs%e3%81%ae%e3%83%ab%e3%83%bc%e3%83%86%e3%82%a3%e3%83%b3%e3%82%b0%e3%81%ae%e4%be%8b-ngroute%e3%80%81routeprovider\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/499","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/comments?post=499"}],"version-history":[{"count":1,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/499\/revisions"}],"predecessor-version":[{"id":41399,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/499\/revisions\/41399"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/media?parent=499"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/categories?post=499"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/tags?post=499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}