I want to insert city.value
in the ng-href
link.
please help me, someone.
this is the textbox
<input id="city" name="states" type="text"
class="txt-dep-ret input-icon-depart country-autocomplete ui-autocomplete-input form-control"
placeholder="Select Origin" allow-custom="false" autocomplete="off">
this is the button link with ng-href
<a id="sbutton" target="_blank" class="btn btn-primary btn-lg"
style="background-color: #E28F13; font-size: 14px"
ng-href="@Url.Action("Booking", "home")?Rooms={{rooms}}&Destination={{city}} &DepartureDate={{departuredate}}&ReturnDate={{returndate}}&Adults1={{Adults1}}&Children1={{Children1}}&C1Age1={{C1Age1}}&C1Age2={{C1Age2}}&C1Age3={{C1Age3}}&C1Age4={{C1Age4}}&Adults2={{Adults2}}&Children2={{Children2}}&C2Age1={{C2Age1}}&C2Age2={{C2Age2}}&C2Age3={{C2Age3}}&C2Age4={{C2Age4}}&Adults3={{Adults3}}&Children3={{Children3}}&C3Age1={{C3Age1}}&C3Age2={{C3Age2}}&C3Age3={{C3Age3}}&C3Age4={{C3Age4}}"
onclick="validate(event);"> Search </a>
I want to set the destination to city.value
答案 0 :(得分:3)
您需要在文本框输入中设置ng-model
。
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="myApp" ng-controller="myCtrl">
<input id="city" name="states" type="text" class="txt-dep-ret input-icon-depart country-autocomplete ui-autocomplete-input form-control" placeholder="Select Origin" allow-custom="false" autocomplete="off" ng-model="hash">
<a ng-href="https://www.google.lk/{{hash}}">Search</a>
</div>
答案 1 :(得分:-1)
应该能够{{city.value}}
。
编辑:这是错误的,请参阅下面的评论或其他答案。
此外,您需要绕过Booking和home的双引号,或将它们更改为单引号。