javascript - 无法加载资源 : the server responded with a status of 404 (Not Found) angular js + ionic

标签 javascript html angularjs angular-ui-router ionic-framework

enter image description here

这是我在 Google Devt Tools 中遇到的错误。有人知道这个问题吗?我尝试多次更改,包括文件结构和 app.js 文件中的 stateProvider(没有 Controller ),但这似乎不是问题所在。 (脚本以正确的文件名和目录包含在 app.js 中)

此外,我的注销和提交帖子按钮也无法正常工作。


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>

最佳答案

404 字面意思是找不到文件。 就这么简单。检查 URL 是否正确,并且没有进行重定向(使用 fiddler)。也许协议(protocol)应该是 https://而不是 http://?也许您需要在 url 中使用“www”?

点击 Chrome 中给出的 url 并查看文件是否存在。

关于javascript - 无法加载资源 : the server responded with a status of 404 (Not Found) angular js + ionic,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25102593/

相关文章:

javascript - Angular 中有 ng-repeat 的替代品吗?

javascript - 设置 fengyuanchen jQuery Cropper.js v3.0.0 预览大小与图像相同

javascript - AngularJS - 在一个 $watch 中调用多个函数

angularjs - UI Bootstrap 下拉菜单在 Firefox 中无法使用/Text Angular ...

html - CSS 将鼠标悬停在某物上并让完全不同的 div 更改其属性

php - 如何回显数据库中查询的结果?

html - 使 HTML5 应用程序可离线使用

javascript - 在对象的对象数组中查找属性的最大值

javascript - 如何在 ngMaterial md-autocomplete 中过滤查询?

javascript - 极小极大算法JS实现