我遇到了角度js预先输入的问题。我有一个具有Description属性的对象,但是如果该属性在字符串末尾包含一个额外的 Enter ,则typeahead会出现类似无法识别的标记的错误,但是当我删除了额外的输入从字符串类型的结尾按预期工作。由于富文本编辑器,附加的 Enter 会被追加。 这是代码:
angular.module('myApp', ['ui.bootstrap']);
function TypeaheadCtrl($scope) {
$scope.states = [{
Description:
"<p>Today's complex display geometries place new testing requirements on makers of AR/VR technologies, embedded displays, and smart devices. Radiant's Chief Solutions Officer, Doug Kreysar, will demonstrate how new optical devices facilitate the measurement of these advanced technologies, including: - Near-to-Eye display (NED) testing in headsets -Angular distribution of near infrared LEDs -View angle performance in displays -Light & color inspection of projected displays (HUDs) A live demonstration featuring Radiant's conoscope and wide FOV lens technologies will accompany the presentation</p>
",
DescriptionTitle:"ABSTRACT",
IsDeleted:false,
ThumbnailImagePath:"33ab802d-ea3d-4bd0-b056-030274876dd9.jpg",
Title1:"New Optical Devices for Display and AR/VR Testing",
Title2:"Doug Kreysar",
Title3:"Chief Solutions Officer, Radiant Vision Systems",
WebinarDate:"2018-06-05T00:00:00",
WebinarID:1,
WebinarVideoLink:"jsgddsg",
Year:2018 }];
}
<div ng-app="myApp">
<div class='container-fluid' ng-controller="TypeaheadCtrl"> State: {{selected| json}}
<input class="input-large" type="text" ng-model="selected" typeahead="search as state.Title2 for state in states | filter:$viewValue | limitTo:8">
</div>
</div>
以下是JSFiddle
的链接请建议一种可行的方法来解决问题,因为我无法从用户那里删除Richtext编辑器,同时从用户那里获取描述数据。
感谢。