ngRoute似乎不起作用。角1.5.7

时间:2017-07-24 09:25:37

标签: javascript angularjs

我知道关于这个主题有几个问题,但没有一个主题帮助我解决了我的问题。

我有: - 404错误 - browserLink:37 [Deprecation]主线程上的同步XMLHttpRequest因其对最终用户体验的不利影响而被弃用。如需更多帮助,请查看https://xhr.spec.whatwg.org/。警告

HTML:

<script src="~/app/app.js"></script>
<script src="~/app/controller.js"></script>
<script src="~/app/parkingCtrl.js"></script>

app.js

(function (angular) {
'use strict';

angular.module("app", ["ngRoute"])

    .config(['$routeProvider', '$httpProvider', '$locationProvider', 
      function ($routeProvider, $httpProvider, $locationProvider) {

        $locationProvider.html5Mode({
            enabled: true,
            requireBase: false
        });

        $httpProvider.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest";


        $routeProvider.
            when("/parking", {
                template: '/locelec/voiturelist',
                controller: "parkingCtrl",
            });

    }]) 



})(window.angular);

1个文件

angular.module('app').controller('FirstController', function () { });

2个文件

angular.module('app').controller('parkingCtrl', ['$rootScope', '$scope', '$routeParams', 
  function ($rootScope, $scope, $routeParams) {

}]);

花了整个周末试图找出路线,开始绝望:)谢谢你的帮助。最好的祝福。

vue:

<script type="text/ng-template" id="/locelec/voiturelist">
<div class="page page-dashboard ng-scope" ng-controller="parkingCtrl">

  <div class="row">
    <div class="col-md-12">
      <h1>Voitures</h1>
    </div>
  </div>
  <div class="row">
    <div class="col-md-12">
      <a class="btn btn-primary" role="button" href="#/bicycles/new">
        Ajoutez nouveau voiture
      </a>
    </div>
  </div>
  <div class="row">
    <div class="col-md-12">
      &nbsp;
    </div>
  </div>
  <div class="row">
    <div class="col-md-12">
      <table class="table table-bordered table-striped">
        <thead>
          <tr>
            <th>Id</th>
            <th>Marque</th>
            <th>Modele</th>
            <th>Carburant</th>
            <th>Numbre de Portes</th>
            <th>Transmission</th>
            <th>Consommation</th>
            <th></th>
          </tr>
        </thead>
        <tbody>
          <tr ng-repeat="vehicule in model.listvehicules | filter: {TypeVehicule : 'voiture'}">
            <td>{{vehicule.Id}}</td>
            <td>{{vehicule.Marque}}</td>
            <td>{{vehicule.Modele}}</td>
            <td>{{vehicule.Carburant}}</td>
            <td>{{vehicule.NumPortes}}</td>
            <td>{{vehicule.Transmission}}</td>
            <td>{{vehicule.Consommation}}</td>
            <!--<td>
              <a class="btn btn-default" role="button" 
                 ng-link="['VoitureEdit', {id: vehicule.Id}]">
                Edit {{vehicule.Id}}
              </a>
            </td>-->
            <td>
              <a class="btn btn-default" role="button" ng-link="['VoitureEdit']">
                 Edit VoitureEdit
              </a>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
</div>
</script>

1 个答案:

答案 0 :(得分:0)

关键问题是

Escape Sequence Character Represented by Sequence
\0  An ASCII NUL (X'00') character
\'  A single quote (') character
\"  A double quote (") character
\b  A backspace character
\n  A newline (linefeed) character
\r  A carriage return character
\t  A tab character
\Z  ASCII 26 (Control+Z); see note following the table
\\  A backslash (\) character
\%  A % character; see note following the table
\_  A _ character; see note following the table

丢失。

我在这个非常好的教程的帮助下意识到这一点。Angularjs route configuration

谢谢大家!