Angularjs 在计数器$index中,检查它,这将是调整后的部分: <select id="accountselector" style="width: 100%;" ng-model="Model.selectedValue"> <optio
在计数器Angularjs 在计数器$index中,检查它,这将是调整后的部分: <select id="accountselector" style="width: 100%;" ng-model="Model.selectedValue"> <optio,angularjs,angularjs-scope,typescript,typescript1.4,typescript1.5,Angularjs,Angularjs Scope,Typescript,Typescript1.4,Typescript1.5,在计数器$index中,检查它,这将是调整后的部分: <select id="accountselector" style="width: 100%;" ng-model="Model.selectedValue"> <option value="0" >--- Select an option ---</option> <option data-ng-repeat="(key, value) in listAccountTypes"
$index
中,检查它,这将是调整后的部分:
<select id="accountselector" style="width: 100%;" ng-model="Model.selectedValue">
<option value="0" >--- Select an option ---</option>
<option data-ng-repeat="(key, value) in listAccountTypes"
value="{{$index + 1}}">{{key}} - {{value}}</option>
</select>
---选择一个选项---
{{key}}-{{value}
但是否有任何特定原因不使用ng select而不是ng选项?是否已尝试通过以下方式进行更改:-但下拉菜单无法绑定您也可以检查图像,查看我以何种形式获取数据。但是否有任何特定原因不使用ng select而不是ng选项?是否已尝试通过以下方式进行更改更改为:-但下拉菜单无法绑定您也可以在可以看到我以何种形式获取数据的位置检查图像。但不使用ng select而不是ng选项有什么具体原因吗?尝试了相同的更改,如:-但下拉菜单无法绑定您也可以在可以看到的位置检查图像我获取的是哪种形式的数据。但是否有任何具体原因不使用ng select而不是ng options?尝试了相同的更改,如:-但下拉列表无法绑定您也可以查看图像,您可以查看我获取数据的形式。谢谢您的回复@Radim,但我如何获取选定值的选定索引在下拉列表中?我添加了更多的细节,并创建了更多的掠夺。。。在这里检查一下。。。希望它能帮助你回复@Radim,但我如何在下拉列表中获得选定值的选定索引?我添加了更多详细信息,并创建了更多的掠夺物。。。在这里检查一下。。。希望它能帮助你回复@Radim,但我如何在下拉列表中获得选定值的选定索引?我添加了更多详细信息,并创建了更多的掠夺物。。。在这里检查一下。。。希望它能帮助你回复@Radim,但我如何在下拉列表中获得选定值的选定索引?我添加了更多详细信息,并创建了更多的掠夺物。。。在这里检查一下。。。希望它能帮助Radim,如果我们在ng模型中进行更改,那么它也会在ng click上绑定,因为对于ng click,我使用的是custom.accountselector,而在上面,您使用的是不同的一个,所以可以使用accountselector?accountselector也可以使用,但我强烈建议使用一些模型{accountselector:0}
。这几乎是必须的。。。因为我们需要分享参考资料…请阅读此。。。为什么我们需要点(有更多详细信息的链接)k,但是我可以在保存数据功能中使用相同的模型值吗?因为以前我做的是:AccountType:create.listAccountTypes,但现在我可以作为AccountType:model.SelectedValue来做,?Radim如果我们在ng模型中进行更改,那么它也会在ng单击时绑定,因为对于ng单击,我使用的是custom.accountselector,而在上面,您使用的是不同的,所以可以使用accountselector?accountselector也可以使用,但我强烈建议使用一些模型{accountselector:0}
。这几乎是必须的。。。因为我们需要分享参考资料…请阅读此。。。为什么我们需要点(有更多详细信息的链接)k,但是我可以在保存数据功能中使用相同的模型值吗?因为以前我做的是:AccountType:create.listAccountTypes,但现在我可以作为AccountType:model.SelectedValue来做,?Radim如果我们在ng模型中进行更改,那么它也会在ng单击时绑定,因为对于ng单击,我使用的是custom.accountselector,而在上面,您使用的是不同的,所以可以使用accountselector?accountselector也可以使用,但我强烈建议使用一些模型{accountselector:0}
。这几乎是必须的。。。因为我们需要分享参考资料…请阅读此。。。为什么我们需要点(有更多详细信息的链接)k,但是我可以在保存数据功能中使用相同的模型值吗?因为以前我做的是:AccountType:create.listAccountTypes,但现在我可以作为AccountType:model.SelectedValue来做,?Radim如果我们在ng模型中进行更改,那么它也会在ng单击时绑定,因为对于ng单击,我使用的是custom.accountselector,而在上面,您使用的是不同的,所以可以使用accountselector?accountselector也可以使用,但我强烈建议使用一些模型{accountselector:0}
。这几乎是必须的。。。因为我们需要分享参考资料…请阅读此。。。为什么我们需要点(有更多详细信息的链接)k,但我可以在保存数据功能中使用相同的模型值吗?因为以前我做的是:AccountType:create.listAccountTypes,但现在我可以作为AccountType:model.SelectedValue来做吗,?
/// <reference path="../interface/interface.ts" />
/// <reference path="../../scripts/typings/jquery/jquery.d.ts" />
/// <reference path="../../scripts/typings/angularjs/angular.d.ts" />
module CustomerNew.controllers {
export class CreateCustomerCtrl {
static $inject = ['$scope', '$http', '$templateCache'];
constructor(protected $scope: ICustomerScope,
protected $http: ng.IHttpService,
protected $templateCache: ng.ITemplateCacheService) {
$scope.getFormData = this.getFormData;
}
public getFormData = (getFormData: any) => {
this.$http.get(doAccountTypeUrl).
success((data, status, headers, config) => {
this.$scope.listAccountTypes = data["AccountCodesDisplayTypes"];
}).
error((data, status) => {
debugger;
console.log("In Error:-Request Failed");
alert(status);
});
}
}
var customerapp = angular.module("CustomerNew", []);
customerapp
.controller('CreateCustomerCtrl', CustomerNew.controllers.CreateCustomerCtrl);
var doAccountTypeUrl = '/API/Create/GetLoadData';
}
</Controller>
if (listAccountTypes.SelectedIndex > -1 && listAccountTypes.SelectedValue != "0")
{
IntlCountryAddres objIntlCountryAddres = objIntlCountryAddressController.GetByCountryId(Convert.ToInt32(listAccountTypes.SelectedValue));
if (objIntlCountryAddres != null && objIntlCountryAddres.id > 0)
{
pnlBillingCountry.Visible = true;
LoadBillingInfo(objIntlCountryAddres);
}
}
else
{
pnlBillingCountry.Visible = false;
}
<select id="accountselector" style="width: 100%;">
<option value="0">--- Select an option ---</option>
<select id="accountselector" style="width: 100%;" ng-options="check docs" ng-model="check docs"></select>
{
"AccountCodesDisplayTypes" :
{
"1": "Code Only",
"2": "Code and Description",
"3": "Description Only",
"N": "no"
}
}
module CustomerNew.controllers {
export class CreateCustomerCtrl {
static $inject = ['$scope', '$http', '$templateCache'];
constructor(protected $scope: ICustomerScope,
protected $http: ng.IHttpService,
protected $templateCache: ng.ITemplateCacheService) {
$scope.getFormData = this.getFormData;
}
public getFormData = (getFormData: any) => {
this.$http
.get(doAccountTypeUrl)
.success((data, status, headers, config) => {
this.$scope.listAccountTypes = data["AccountCodesDisplayTypes"];
}).
error((data, status) => {
debugger;
console.log("In Error:-Request Failed");
alert(status);
});
}
}
//var customerapp = angular.module("CustomerNew", []);
var customerapp = angular.module("CustomerNew");
customerapp
.controller('CreateCustomerCtrl', CustomerNew.controllers.CreateCustomerCtrl);
var doAccountTypeUrl = 'API/Create/GetLoadData.json';
}
<div data-ng-app="CustomerNew" data-ng-controller="CreateCustomerCtrl as custom" ng-init=getFormData();>
<table>
<tr>
<td>
<select id="accountselector" style="width: 100%;">
<option value="0">--- Select an option ---</option>
<option data-ng-repeat="(key, value) in listAccountTypes" value="{{key}}">{{key}} - {{value}}</option>
</select>
</td>
</tr>
</table>
</div>
constructor(protected $scope: ICustomerScope,
protected $http: ng.IHttpService,
protected $templateCache: ng.ITemplateCacheService) {
$scope.getFormData = this.getFormData;
$scope.Model = { selectedValue : "0" };
}
<div data-ng-app="CustomerNew" data-ng-controller="CreateCustomerCtrl as custom"
ng-init="getFormData();">
<table>
<tr>
<td>
<select id="accountselector" style="width: 100%;" ng-model="Model.selectedValue">
<option value="0" >--- Select an option ---</option>
<option data-ng-repeat="(key, value) in listAccountTypes"
value="{{key}}">{{key}} - {{value}}</option>
</select>
</td>
</tr>
</table>
Selected value: {{Model.selectedValue}}
</div>
...<select id="accountselector" style="width: 100%;" ng-model="selectedValue">
<select id="accountselector" style="width: 100%;" ng-model="Model.selectedValue">
<option value="0" >--- Select an option ---</option>
<option data-ng-repeat="(key, value) in listAccountTypes"
value="{{$index + 1}}">{{key}} - {{value}}</option>
</select>