Domanda

Sto cercando di implementare una ricerca in base a determinati parametri.Ho la vista / casa e che consiste una forma.Non verrà reindirizzarsi / modificare-cliente: / Visualizza cliente con ID cliente.

HTML ,

<form>
From: <input type="text" name="customernumber"><br>

<a href="#/edit-customer/3">asdasd</a>
</form>
.

percorso,

app.config(['$routeProvider',
  function($routeProvider) {
    $routeProvider.
      when('/', {
        title: 'Customers',
        templateUrl: 'partials/customers.html',
        controller: 'listCtrl'
      })
      .when('/edit-customer/:customerID', {
        title: 'Edit Customers',
        templateUrl: 'partials/edit-customer.html',
        controller: 'editCtrl',
        resolve: {
          customer: function(services, $route){
            var customerID = $route.current.params.customerID;
            return services.getCustomer(customerID);
          }
        }
      }).when('/home',{
        title: 'home',
        templateUrl:'partials/home.html',
      }).when('/results',{
        title: 'search results',
        templateUrl: 'partials/results.html',
      })
      .otherwise({
        redirectTo: '/'
      });
}]);
.

Come posso ottenere questo?

È stato utile?

Soluzione

Questo è ciò che capisco che stai cercando, nota la direttiva NG-Model su elemento di input

<form>
From: <input type="text" ng-model="customerId" name="customernumber"><br>

<a href="#/edit-customer/{{customerId}}">asdasd</a>
</form>
.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top