I am having trouble with my Bootstrap UI modal.
I have a modal to capture address details from the user, but the model is always empty for some reason. An extract of my template:
<form class="form-horizontal" style="padding: 64px;">
<div class="form-group">
<label for="firstName" class="col-sm-3 control-label">First name</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="firstName" ng-model="model.firstName">
</div>
</div>
<div class="form-group">
<label for="lastName" class="col-sm-3 control-label">Last name</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="lastName" ng-model="model.lastName">
</div>
</div>
<!-- etc -->
</form>
And my controller:
module Test.Controllers {
"use strict";
export class ChooseAddressController {
static $inject = ["$modal", "AddressService"];
private addressService: Services.AddressService;
public addresses: Array<Models.Address>;
public modal;
constructor($modal, addressService: Services.AddressService) {
this.addressService = addressService;
this.modal = $modal;
}
public newAddressClicked(): void {
var newAddress = this.addressService.createNewAddress();
this.editAddress(newAddress);
}
public editAddress(address: Models.Address): void {
address.firstName = "Test 1";
address.lastName = "Test 2";
var modalInstance = this.modal.open({
animation: true,
templateUrl: 'dialogs/editAddressDialog.html',
backdrop: "static",
backdropClass: "windowModal",
keyboard: false,
resolve: {
model: () => address
}
});
}
}
}
I would expect that the dialog contains the "Test 1" and "Test 2" data, but it doesn't. I have looked at this plnkr as suggested by this post but it doesn't appear to work for me, which is frustrating.
What am I doing wrong?