关键词:
【中文标题】加载资源失败:服务器响应状态为 404 (Not Found) angular js + ionic【英文标题】:Failed to load resource: the server responded with a status of 404 (Not Found) angular js + ionic 【发布时间】:2014-09-25 23:27:12 【问题描述】:这是我在 Google Devt Tools 中遇到的错误。有谁知道这个问题?我尝试多次更改,包括 app.js 文件中的文件结构和 stateProvider(没有控制器),但这似乎不是问题。 (脚本包含在 app.js 中,文件名和目录正确)
此外,我的注销和 submitPost 按钮也无法正常工作。
newpost.html
<div class="modal slide-in-up" ng-controller="NavCtrl">
<!-- Modal header bar -->
<header class="bar bar-header bar-secondary">
<button class="button button-clear button-primary" ng-click="close()">Cancel</button>
<h1 class="title">New Shout</h1>
<button class="button button-positive" ng-click="submitPost()">Done</button>
</header>
<!-- Modal content area -->
<ion-content class="padding has-header">
<form class ng-submit="submitPost()" ng-show="signedIn()">
<div class="form-group">
<input type="text" class="form-control" placeholder="Title" ng-model="post.title">
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Link" ng-model="post.url">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</ion-content>
</div>
controller.js 文件
app.controller('NavCtrl', function ($scope, $firebase, $location, Post, Auth, $ionicModal)
$scope.post = url: 'http://', title: '';
// Create and load the Modal
$ionicModal.fromTemplateUrl('newpost.html', function(modal)
$scope.taskModal = modal;
,
scope: $scope,
animation: 'slide-in-up'
);
// Open our new task modal
$scope.submitPost = function ()
Post.create($scope.post).then(function (postId)
$scope.post = url: 'http://', title: '';
$location.path('/posts/' + postId);
$scope.taskModal.show();
);
;
$scope.close = function()
$scope.taskModal.hide();
;
$scope.logout = function ()
Auth.logout();
;
);
项目列表页面,post.html
<ion-header-bar class="bar-positive" ng-controller="NavCtrl">
<button class="button button-clear" ng-click="submitPost()">New</button>
<h1 class="title"><b><a class="navbar-brand" href="#/posts">MyApp</a></b></h1>
<button class="button button-clear" ng-click="logout()">Logout</button>
</ion-header-bar>
【问题讨论】:
【参考方案1】:404 字面意思是找不到文件。 就这么简单。检查 URL 是否正确,并且没有进行重定向(使用提琴手)。也许协议应该是 https:// 而不是 http://?也许您需要在网址中添加“www”?
点击Chrome中给出的url,查看文件是否存在。
【讨论】:
谢谢@Erti-Chris Eelmaa 当我点击错误时,它说Cannot GET /newpost.html。我发现了一个错误 $ionicModal.fromTemplateUrl('newpost.html', function(modal) 应该是 $ionicModal.fromTemplateUrl('templates/newpost.html', function(modal) 但是现在当我运行 grunt serve 时,它永久加载...我无法按 F12 进行故障排除.. 那是因为你处于无限递归中。你的 newpost.html 总是在创建新的 NavCtrl,而 NavCtrl 总是在创建 newpost.html,它会一直持续下去。 @Erti-Chria Eelmaa 有什么建议可以更正代码吗?我认为将 nav.ctrl 放在 html 中只是意味着它使用该控制器。递归是如何发生的? 去掉 ng-controller="NavCtrl" 并将其放在“body”标签或更靠近您不会每次都重新加载控制器的位置。【参考方案2】:不确定是否有人感兴趣,但是在尝试上传到 Firebase 存储时遇到了类似的问题,这是我解决它的方法。 The Error screenshot where upload fails with 503 and then 400 after 75% progress
我用于上传的代码段是
//Event: data.Event,
// Date: data.Date,
// Time: data.Time
var data = getData();
data.filename=uploadfile.name;
var metadata =
customMetadata:
data
var storageRef = firebase.storage().ref().child("features");
console.log("Filenames to upload :" + uploadfile.name);
var fileRef = storageRef.child(uploadfile.name);
var uploadTask = fileRef.put(uploadfile,metadata);
问题在于自定义元数据,一旦我将其更改为这样,
var metadata =
customMetadata:
Event: data.Event,
Date: data.Date,
Time: data.Time
上传开始工作。因此,如果在设置自定义元数据时出现错误,firebase 错误并可能不会作为原因提供。
在这里工作的屏幕截图 successful upload once the custom meta data is corrected
【讨论】:
【参考方案3】:将 <base href="/">
从 index.html 更改为 <base href="./">
【讨论】:
错误:加载资源失败:服务器响应状态为 404(未找到)
】错误:加载资源失败:服务器响应状态为404(未找到)【英文标题】:Error:Failedtoloadresource:theserverrespondedwithastatusof404(NotFound)【发布时间】:2017-07-0304:36:14【问题描述】:这是我第一次在线上传网站。Here是链接。我正在使用轮... 查看详情
加载资源失败:服务器响应状态为 404(未找到)
】加载资源失败:服务器响应状态为404(未找到)【英文标题】:Failedtoloadresource:theserverrespondedwithastatusof404(NOTFOUND)【发布时间】:2013-03-3003:23:16【问题描述】:我是uisngpython,要将数据从json文件显示到页面,我收到以下错误Fail... 查看详情
Apache Cordova:“加载资源失败:服务器响应状态为 404(未找到)”
】ApacheCordova:“加载资源失败:服务器响应状态为404(未找到)”【英文标题】:ApacheCordova:"Failedtoloadresource:theserverrespondedwithastatusof404(NotFound)"【发布时间】:2016-01-0408:48:27【问题描述】:我收到错误消息:“加载资源... 查看详情
加载资源失败:服务器响应状态为 404(未找到)
】加载资源失败:服务器响应状态为404(未找到)【英文标题】:Failedtoloadresource:theserverrespondedwithastatus404(notfound)【发布时间】:2015-12-0117:06:28【问题描述】:我在javascript和ajax上遵循lynda教程,并在主题“使用同步XHR请求”主... 查看详情
加载资源失败:服务器响应状态为 404(未找到)
】加载资源失败:服务器响应状态为404(未找到)【英文标题】:Failedtoloadresource:theserverrespondedwithastatusof404(NotFound)【发布时间】:2014-07-1520:37:19【问题描述】:我在Eclipse中使用WorklightStudio。我创建了一个新工作区并创建了一个... 查看详情
加载资源失败:服务器响应状态为 404(未找到)显示在控制台上
】加载资源失败:服务器响应状态为404(未找到)显示在控制台上【英文标题】:Failedtoloadresource:theserverrespondedwithastatusof404(NotFound)displayedonconsole【发布时间】:2021-10-2319:00:43【问题描述】:Image我的文件结构是index.html、script.js... 查看详情
Angular 5 - 加载资源失败:服务器响应状态为 404(未找到)
】Angular5-加载资源失败:服务器响应状态为404(未找到)【英文标题】:Angular5-Failedtoloadresource:theserverrespondedwithastatusof404(NotFound)【发布时间】:2018-09-0703:44:17【问题描述】:我正在尝试从node_modules中的包中获取svg图像,我从我... 查看详情
加载资源失败:服务器响应状态为 404 () font-awesome [重复]
】加载资源失败:服务器响应状态为404()font-awesome[重复]【英文标题】:Failedtoloadresource:theserverrespondedwithastatusof404()font-awesome[duplicate]【发布时间】:2021-11-0923:32:12【问题描述】:我正在使用jsf和adminlte主题。我在使用图标时遇到... 查看详情
加载资源失败:服务器使用 Angular 响应状态为 404 (),使用 GitHub Pages 部署
】加载资源失败:服务器使用Angular响应状态为404(),使用GitHubPages部署【英文标题】:Failedtoloadresource:theserverrespondedwithastatusof404()usingAngular,deployingwithGitHubPages【发布时间】:2021-07-3020:49:51【问题描述】:我正在尝试使用Angular和Gi... 查看详情
加载资源失败:服务器响应状态为 404 () Spring boot with JWT
】加载资源失败:服务器响应状态为404()SpringbootwithJWT【英文标题】:Failedtoloadresource:theserverrespondedwithastatusof404()SpringbootwithJWT【发布时间】:2021-10-2118:35:55【问题描述】:您好,我正在使用Jwt安全性创建SpringBoot项目来为用户生... 查看详情
加载资源失败:服务器使用 laravel 8 / ajax 响应状态为 404(未找到)
】加载资源失败:服务器使用laravel8/ajax响应状态为404(未找到)【英文标题】:Failedtoloadresource:theserverrespondedwithastatusof404(NotFound)usinglaravel8/ajax【发布时间】:2021-09-1018:09:10【问题描述】:我正在尝试在HTMLbloc中显示图像,所以... 查看详情
加载资源失败:http://website.azurewebsites.net/signalr/hubs 服务器响应状态为 404(未找到)
】加载资源失败:http://website.azurewebsites.net/signalr/hubs服务器响应状态为404(未找到)【英文标题】:Failedtoloadresource:thehttp://website.azurewebsites.net/signalr/hubsserverrespondedwithastatusof404(NotFound)【发布时间】:2017-01-0421:19:02【问题描述】... 查看详情
在 CPanel 上部署 Node.js React 应用程序 - “加载资源失败:服务器响应状态为 404 ()”
】在CPanel上部署Node.jsReact应用程序-“加载资源失败:服务器响应状态为404()”【英文标题】:DeployingaNode.jsReactApp,onCPanel-\'Failedtoloadresource:theserverrespondedwithastatusof404()\'【发布时间】:2019-08-1121:46:37【问题描述】:我将构建文件夹... 查看详情
在本地解析服务器上运行的解析仪表板错误出现:加载资源失败:服务器响应状态为 404(未找到)
】在本地解析服务器上运行的解析仪表板错误出现:加载资源失败:服务器响应状态为404(未找到)【英文标题】:parse-dashboardrunningonlocalparse-servererrorsoutinwith:Failedtoloadresource:theserverrespondedwithastatusof404(NotFound)【发布时间】:2021... 查看详情
为啥 Wordpress 无法加载资源?它表示服务器响应状态为 404(未找到)
】为啥Wordpress无法加载资源?它表示服务器响应状态为404(未找到)【英文标题】:whyWordpressfailedtoloadtheresource?Itsaidthattheserverrespondedwithastatusof404(notFound)为什么Wordpress无法加载资源?它表示服务器响应状态为404(未找到)【发布... 查看详情
这是啥意思? “加载资源失败:服务器响应状态为 405(不允许方法)”
】这是啥意思?“加载资源失败:服务器响应状态为405(不允许方法)”【英文标题】:Whatdoesthismean?"Failedtoloadresource:theserverrespondedwithastatusof405(MethodNotAllowed)"这是什么意思?“加载资源失败:服务器响应状态为405(不允... 查看详情
加载资源失败:服务器响应状态为 439(应用程序不活动)
】加载资源失败:服务器响应状态为439(应用程序不活动)【英文标题】:Failedtoloadresource:theserverrespondedwithastatusof439(Applicationinactive)【发布时间】:2017-03-1513:22:25【问题描述】:我在VisualStudio2015中开发一个Web应用程序,我的浏... 查看详情
获取 Javascript 服务加载资源失败:服务器响应状态为 401(未授权)
】获取Javascript服务加载资源失败:服务器响应状态为401(未授权)【英文标题】:fetchJavascriptserviceFailedtoloadresource:theserverrespondedwithastatusof401(Unauthorized)【发布时间】:2021-01-2900:01:18【问题描述】:我尝试使用javascript(特别是获... 查看详情