Pregunta

Estoy tratando de implementar una búsqueda basada en ciertos parámetros.Tengo la vista / casa y eso consiste en un formulario.No volveré a redirigir a / editar-cliente: / CustomerID Ver con identificación con el cliente.

html ,

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

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

ruta,

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: '/'
      });
}]);

¿Cómo puedo lograr esto?

¿Fue útil?

Solución

Esto es lo que entiendo que está buscando, nota NG-Model Directive en el elemento de entrada

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

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top