html - angularJS脚本文件在html中调用时不起作用
问题描述
仅呈现网页的 html 输出和 {{10 + 10}}。我不确定我做错了什么,但我猜这是我的视觉工作室项目中的一些设置类型问题。
(function () {
var app = angular.module("ShipmentsHome", []);
var EditShipmentsController = function ($scope) {
$scope.message = "--Still need to create grid here--";
};
app.controller("EditShipmentsController", ["$scope", EditShipmentsController]);
}());
!DOCTYPE html>
<html>
<head>
<title>Shipments Home</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.10/angular.min.js"></script>
<script src="../../lib/home.js"></script>
</head>
<body ng-app="ShipmentsHome" ng-controller="EditShipmentsController">
<h1>Product Transfers</h1>
<p>Create or modify a transfer below:</p>
<div> {{message}}</div>
<p>look above for message from controller</p>
<h2>{{10 + 10}}</h2>
</body>
</html>
解决方案
问题可能出在您的相对路径上。当我用实际的控制器脚本替换脚本源时,我得到了它。请检查您的路径并更正它。
推荐阅读
- email - 在 GO 中使用代理后面的 SMTP / 电子邮件客户端
- java - 工具栏后退按钮和 onBackPressed 方法的区别
- node.js - Nodejs:启用流式传输时,Morgon 日志未记录完整的响应时间
- google-drive-api - 是否可以让 API 密钥访问 Google Drive 文件,但匿名用户不能访问?
- amazon-web-services - 在 aws 实例中无法访问我的 Spring Boot 应用程序
- installation - 尽管使用 ODT,但与 MS Office Pro 2016 并行安装 Visio 时出现问题
- api - 执行 API 请求以生成金狗的随机图像/链接
- javascript - 通过vue-cli3创建的vue项目中,monaco-editor的ctrl + v特性无效
- purescript - 在 purescript 中获取新类型的记录底层类型
- c# - 实体框架代码优先:如何添加与现有实体相关的实体?