在AngularJS中使用带有Select标记的ng开关可能存在错误
我与ng开关一起使用的Select(选择)标签在设置一次后无法正确显示或正常工作在AngularJS中使用带有Select标记的ng开关可能存在错误,angularjs,Angularjs,我与ng开关一起使用的Select(选择)标签在设置一次后无法正确显示或正常工作 <select ng-model="visuals" ng-options="visual for visual in visuals"> 参见JSFIDLE: 提前谢谢! :D您不应该使用ng模型绑定可视内容,因为它是项目列表。将其设置为将列表值替换为所选项(即字符列表)。导致这种奇怪的行为 <select ng
<select ng-model="visuals" ng-options="visual for visual in visuals">
参见JSFIDLE:
提前谢谢!
:D您不应该使用ng模型绑定
可视内容,因为它是项目列表。将其设置为将列表值替换为所选项(即字符列表)。导致这种奇怪的行为
<select ng-model="item" ng-options="visual for visual in visuals">
您的交换机使用也不正确,您需要在交换机块中设置条件
<div ng-switch on="item">
<span ng-switch-when="lots">Youtube</span>
<span ng-switch-default></span>
</div>
然后替换跨度内容。当然,必须在作用域中定义一个新变量来保存HTML内容:
$scope.youtube = "<hr/>This is an HTML content<hr/>";
$scope.youtube=“
这是一个HTML内容
”;
我更新了JSFIDLE:
<span ng-switch-when="lots" ng-bind-html-unsafe="youtube">Could not evaluate 'youtube' variable</span>
$scope.youtube = "<hr/>This is an HTML content<hr/>";