0
我有一個AngularJS控制器,我想在我的MVC webform查看頁面中使用。如何在webform中實現AngularJS控制器?
我創建了一個簡單的代碼,但似乎沒有工作。
Test.js
angular.module('project').controller("TestCtrl", function($scope){
$scope.text = 'test';
});
View.aspx
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<SampleProject.Models.ReportInfo>" %>
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" ng-app="project">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server" ng-controller="TestCtrl">
{{text}}
</form>
</body>
</html>
我期待看到這個詞測試,但它不綁定。我只看到
我在其他的js引用的angular.js。我試圖把[],但我的頁面沒有完成從加載 – chary
我也試過把ng-app的
標記,仍然無法正常工作。我錯過了什麼嗎? – chary我在http://plnkr.co/edit/rC5yVV?p=preview上創建了一個Plunk – user2789093