ng-include不适用于ASP.NET应用程序

时间:2013-06-16 04:41:34

标签: asp.net angularjs

我正在开发一个ASP.NET应用程序,我正在尝试在我的应用程序中使用angular.js.

出于某种原因,当使用ng-include时,我看不到我想要嵌入的html。

这是我的代码:

Default.aspx的:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MyPage.aspx.cs" Inherits="DefaultWebApp.Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ng="http://angularjs.org">

<head runat="server">
    <title></title>
    <link rel="Stylesheet" href="Style/style.css" type="text/css" />
    <link rel="Stylesheet" href="JS/jquery/css/start/jquery-ui-1.8.21.custom.css" type="text/css" />
    <script type="text/javascript" src="js/jquery/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="js/jquery/js/jquery-ui-1.8.21.custom.min.js"></script>   
</head>
<body ng-controller="RouteCtrl">
<div id="content">
            <div ng-include src='"Template/IncludeCheck.html"'></div>
        </div> 
    <script type="text/javascript" src="JS/angular.min.js" ng:autobind></script>
    <script type="text/javascript" src="JS/controllers.js"></script>     
</body> 
</html>

controllers.js:

function RouteCtrl($route) {
    var self = this;

    $route.when('/multi', { template: 'Template/IncludeCheck.html' });

    $route.otherwise({ redirectTo: '/multi' });

    $route.parent(this);
}

IncludeCheck.html:

<h1>Include check</h1>
<p>Include check include check</p>

我可以在浏览器中看到“angular.min.js”和“controllers.js”成功加载,我也检查了相对路径,没关系。

我还能注意什么?

更新

只是想提一下我没有在我的项目中使用MVC。

它是否可以在常规ASP.NET应用程序中运行?

重要的是还要提到我在“开发者工具”中没有看到“IncludeCheck.html”被加载..即使我改变了路径。

更新2:

我也无法达到“/ multi”..我找不到404

0 个答案:

没有答案
相关问题