Angularjs 用于在salesforce.com中不工作的null的角度

Angularjs 用于在salesforce.com中不工作的null的角度,angularjs,salesforce,Angularjs,Salesforce,在salesforce.com Visualforce页面中,未显示null的默认选项值。我有一个非常简单的select组件,其中一个选项子项用于Angular Docs定义的none或null值 以下是应用程序: <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular.min.js"/> <script> var myApp = angular.module('myAp

在salesforce.com Visualforce页面中,未显示null的默认选项值。我有一个非常简单的select组件,其中一个选项子项用于Angular Docs定义的none或null值

以下是应用程序:

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular.min.js"/>
<script>
    var myApp = angular.module('myApp',[]);

    function MyCtrl($scope) {
        $scope.colors = [
            {name:'black', shade:'dark'},
            {name:'white', shade:'light'},
            {name:'red', shade:'dark'},
            {name:'blue', shade:'dark'},
            {name:'yellow', shade:'light'}
        ];
    }
</script>

<div ng-app="myApp">
    <div ng-controller="MyCtrl">
        <select ng-model="color" ng-options="c.name for c in colors">
            <option value="">-- choose color --</option>
        </select>   
        {{color.name}}
    </div>
</div>

正如您在此页面上看到的,,-选择颜色-选项不显示。但是在这个jsfiddle上,它工作得非常好。你知道为什么salesforce.com Visualforce页面中没有显示“无”选项吗?

在示例页面中,你有一个无属性标记,你需要value=attribute,我打赌它会像你的小提琴一样工作。我注意到当我把你的页面源代码复制到小提琴上时,它的行为是一样的,没有默认值。是的,我自己才发现。Salesforce正在删除空属性,因此值=永远不会在页面上呈现,这是一个错误。还是不知道怎么解决。我认为这是angulars的一个bug/功能请求,它应该处理一个没有价值的问题,因为我有两个可能的临时解决方案,你可以尝试,它们非常长,所以我将在回答中发布它们。我完全同意你的观点,这是一个可能的bug,我想不出任何理由不应该解析空标记。不过,他们可能有更好的解释。