无法加载资源:服务器响应状态为404(未找到)角度js +离子

Thi*_*rer 4 html javascript angularjs angular-ui-router ionic-framework

在此输入图像描述

这是来自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>
Run Code Online (Sandbox Code Playgroud)


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();
    };
});
Run Code Online (Sandbox Code Playgroud)


项目列表页面,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>
Run Code Online (Sandbox Code Playgroud)

Vik*_*ate 12

从index.html更改<base href="/"><base href="./">


Ert*_*maa 6

404字面意思是找不到文件.这很简单.检查URL是否正确,并且没有重定向(使用fiddler).也许协议应该是https://而不是http://?也许你需要在URL中使用" www "?

点击Chrome中提供的网址,查看该文件是否存在.