我对anglur路由有问题,它没有显示注入的HTML视图的内容,可能是什么问题? [英] I've problem with anglur routing, it doesn't show the content of the injected HTML view, what might be the issue ?

查看:169
本文介绍了我对anglur路由有问题,它没有显示注入的HTML视图的内容,可能是什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的index.html

this is my index.html

<pre><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" ng-app="myapp">
<head>
    <title></title>
    <script src="scripts/angular-route-min.js"></script>
    <script src="scripts/angular.min.js"></script>
    <script src="scripts/JavaScript1.js"></script>
</head>
<body>
    <a href="#home">Home</a>
    <table ng-view></table>
   
</body>
</html>





这是我的脚本文件



here is my script file

<pre>/// <reference path="angular.min.js" />
/// <reference path="angular-route-min.js" />
var app = angular.module("myapp", ["ngRoute"])
                 .config(function ($routeProvider) {
                     $routeProvider.when("/home", {
                         templateUrl: "Templates/home.html",
                         controller: "homectrl"
                     })
                 }).controller("homectrl", function ($scope) {
                     $scope.message = "home page";
                 });





以下是注入的视图





below is the injected view

<pre><h1>{{message}}</h1>
<h2>hi</h2>





我尝试过:



尝试了各种更改语法,但没有使用



What I have tried:

tried various of changing syntax but no use

推荐答案

routeProvider){
routeProvider) {


routeProvider.when( / home,{
templateUrl: Templates / home.html
controller: homectrl
})
})。controller( homectrl function
routeProvider.when("/home", { templateUrl: "Templates/home.html", controller: "homectrl" }) }).controller("homectrl", function (


scope){


这篇关于我对anglur路由有问题,它没有显示注入的HTML视图的内容,可能是什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆