[英]Failed to load resource: the server responded with a status of 404 (Not Found) angular js + ionic
This is the error im having from Google Devt Tools. 这是来自Google Devt Tools的错误。 Anyone knows the problem?
有谁知道这个问题? I tried to change in many times including the file structure and the stateProvider (no controllers for that) in app.js file but it does not seem to be the issue.
我尝试在app.js文件中多次更改,包括文件结构和stateProvider(没有控制器),但它似乎不是问题。 (script is included in app.js with correct file name and directory)
(脚本包含在app.js中,文件名和目录正确)
In addition, my logout and submitPost buttons arent working as well. 另外,我的注销和submitPost按钮也不起作用。
newpost.html 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 file 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();
};
});
List of items page, post.html 项目列表页面,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>
404 literally means that file was not found. 404字面意思是找不到文件。 It's simple as that .
这很简单 。 Check if the URL is right, and there are no rediretions being done(use fiddler).
检查URL是否正确,并且没有重定向(使用fiddler)。 Perhaps the protocol should be https:// istead of http://?
也许协议应该是https://而不是http://? Perhaps you need " www " in url?
也许你需要在URL中使用“ www ”?
Click the url given in Chrome and see if the file exists. 点击Chrome中提供的网址,查看该文件是否存在。
Not sure if anyone is interested, but Experienced a similar problem when trying to upload to firebase storage here is how i resolved it. 不确定是否有人感兴趣,但在尝试上传到firebase存储时经历过类似的问题是我如何解决它。 The Error screenshot where upload fails with 503 and then 400 after 75% progress
错误屏幕截图,其中上传失败时为503,然后是在75%进度后上传400
The code segment I use for Upload is 我用于上传的代码段是
//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);
The Problem was with custom meta data, once I changed it to like this, 问题出在自定义元数据上,一旦我将其改为这样,
var metadata = {
customMetadata: {
Event: data.Event,
Date: data.Date,
Time: data.Time
}
}
the upload started working. 上传开始工作。 So, if there is an error in setting custom meta data, firebase errors out and possible does not provide that as a reason.
因此,如果在设置自定义元数据时出错,则firebase错误输出并且可能不会将其作为原因提供。
Screenshot of working here successful upload once the custom meta data is corrected 在更正自定义元数据后 ,在此处成功上载的屏幕截图
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.