我正在使用$newObj = new AdCreative(null, 'act_account_id');
$newData = [];
$fields = [
AdCreativeFields::NAME,
AdCreativeFields::TITLE,
AdCreativeFields::BODY,
AdCreativeFields::OBJECT_URL,
AdCreativeFields::LINK_URL,
AdCreativeFields::IMAGE_HASH,
AdCreativeFields::OBJECT_STORY_ID,
AdCreativeFields::OBJECT_STORY_SPEC,
AdCreativeFields::URL_TAGS,
];
foreach ($fields as $field) {
$value = $oldAdCreative->{$field};
if(isset($newValues[$field])){
$value = $newValues[$field];
}
$newData[$field] = $value;
}
$newObj->setData($newData);
$newObj->create();
// Assigning New Creative ID to Ad
$ad = new Ad($adId);
$ad->update(array(
'creative' => ['creative_id' => $newObj->{AdCreativeFields::ID}],
'redownload' => true,
));
进行观看。我正在使用JSP
和angularjs
我有一个文本框,在该文本框中有一个名为javascript
的值。 12.542001
应该包含相同内容,但在我显示时,我只想在文本框中显示ng-model
。
如果我使用12.54
,那么它会对值进行舍入,但我不想舍入该值...
答案 0 :(得分:1)
试试这个
console.log(parseFloat(Math.round(12.542001 * 100) / 100).toFixed(2));
//or use
num = "122.542001";
var spV= num.split(".");
console.log(spV[0] +"."+ spV[1].substring(0,2));

如果您的ng型号名称为$scope.totalnumber
。然后尝试这个
$scope.totalnumber = parseFloat(Math.round($scope.totalnumber * 100) / 100).toFixed(2)