Javascript 这个网站刚刚停止工作
下面是我的整个angular.js索引页面,五分钟前该页面按预期工作,显示了我设置的列表中数据库中的5个独立条目。重新启动chrome后,它不再工作,我收到以下错误:错误:Javascript 这个网站刚刚停止工作,javascript,angularjs,json,Javascript,Angularjs,Json,下面是我的整个angular.js索引页面,五分钟前该页面按预期工作,显示了我设置的列表中数据库中的5个独立条目。重新启动chrome后,它不再工作,我收到以下错误:错误: .职位{ 边际:0.02米0; 列表样式类型:无; 填充:0; 宽度:50em; } 李先生{ 位置:相对位置; 左:0; 背景色:#EEE; 边缘:.5em; 填充:.3em0; 高度:20em; 边界半径:4px; } .posts.text{ 位置:相对位置; 顶部:-3px; } GWAT网站和设计 {{pos
.职位{
边际:0.02米0;
列表样式类型:无;
填充:0;
宽度:50em;
}
李先生{
位置:相对位置;
左:0;
背景色:#EEE;
边缘:.5em;
填充:.3em0;
高度:20em;
边界半径:4px;
}
.posts.text{
位置:相对位置;
顶部:-3px;
}
GWAT网站和设计
-
{{post.title}}
{{post.pBody}}
{{post.category}}
var-app=angular.module('myApp',[]);
app.controller('postsCtrl',函数($scope,$http){
$scope.myUrl=$sce.trustAsResourceUrl('https://www.angularjs.org');
$scope.changeIt=函数(changUrl){
$scope.myUrl=$sce.trustAsResourceUrl('changUrl');
}
$http.get(“http://127.0.0.1:8081/process_get")
.then(函数(响应){$scope.names=response.data;});
});
我从控制台知道,我的HTTPGET仍然返回一个未更改的适当json。对于此错误或我遗漏的一些小错误,如有任何帮助,我们将不胜感激。有一个打字错误。另外,
ng src
值需要用双引号括起来
更改
到
另外,将$sce
注入控制器
演示
var-app=angular.module('myApp',[]);
app.controller('postsCtrl',函数($scope,$http,$sce){
$scope.myUrl=$sce.trustAsResourceUrl('https://www.angularjs.org');
$scope.changeIt=函数(changUrl){
$scope.myUrl=$sce.trustAsResourceUrl('changUrl');
}
$http.get(“http://127.0.0.1:8081/process_get")
.then(函数(响应){$scope.names=response.data;});
})
.posts{
边际:0.02米0;
列表样式类型:无;
填充:0;
宽度:50em;
}
李先生{
位置:相对位置;
左:0;
背景色:#EEE;
边缘:.5em;
填充:.3em0;
高度:20em;
边界半径:4px;
}
.posts.text{
位置:相对位置;
顶部:-3px;
}
GWAT网站和设计
-
{{post.title}}
{{post.pBody}}
{{post.category}}
这修复了我遇到的错误,但它不再在ng repeat中循环。html中是否存在任何明显的原因?我不认为这可能是我正在运行的node.js文件,因为它没有更改,但我可以补充说,如果有必要,出于某种原因发布json ArrayVM,我必须更改某些内容,以停止运行我需要使用names.retRows,而现在只需要名称
<!DOCTYPE html>
<html >
<script
src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js">
</script>
<style>
.posts {
margin: 0 0 2em 0;
list-style-type: none;
padding: 0;
width: 50em;
}
.posts li {
position: relative;
left: 0;
background-color: #EEE;
margin: .5em;
padding: .3em 0;
height: 20em;
border-radius: 4px;
}
.posts .text {
position: relative;
top: -3px;
}
</style>
<body>
<div ng-app="myApp" ng-controller="postsCtrl">
<h1>GWAT Websites and Designs</h1>
<ul class="posts">
<li *ng-repeat="post in names.retRows">
{{post.title}}<br>
{{post.pBody}}<br>
{{post.category}}<br>
<iframe ng-src={{myUrl}})></iframe><br><br>
</li>
</ul>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('postsCtrl', function($scope, $http) {
$scope.myUrl = $sce.trustAsResourceUrl('https://www.angularjs.org');
$scope.changeIt = function (changUrl) {
$scope.myUrl = $sce.trustAsResourceUrl('changUrl');
}
$http.get("http://127.0.0.1:8081/process_get")
.then(function (response) {$scope.names = response.data;});
});
</script>