如何根据Angular 1.x.x中的语言环境呈现全名(名字+姓氏/姓氏+名字)。我将“名字”,“姓氏”和“语言环境”作为字符串
我目前有一个地区列表及其全名排序方案。 [前+后]或[后+前]
控制器:
$ctrl = this;
$ctrl.firstName = "John";
$ctrl.lastName = "Doe";
$ctrl.locale = languageService.langLocale();
var fullnameGen = function(firstName, lastName) {
var order = getOrder(locale);
var fullname = "";
for(ele in order) {
switch(ele){
case FIRST_NAME: fullname += firstName;
case LAST_NAME: fullname += lastName;
}
}
}
$ctrl.fullName = fullNameGen(firstName,lastName);
查看:
<div> Full Name: </div> <div> {{$ctrl.fullName}} </div>