Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/447.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如果为ng,则选择ng更改_Javascript_Angularjs - Fatal编程技术网

Javascript 如果为ng,则选择ng更改

Javascript 如果为ng,则选择ng更改,javascript,angularjs,Javascript,Angularjs,我为angular+coffee创建了一个视图,并检测到错误: 如果选择了“类别”,则“子类别”不起作用。 当我移除ng时,如果它有效 代码: 任何 总是 后处理 类别 类别: 子类别: 始终在ng模型中使用对象。由于ng if创建子作用域,您的原语绑定将中断。您可以将ng if替换为ng show,作为解决方法。是否解决了此问题? <div class="form-group"> <div class="row-flu

我为angular+coffee创建了一个视图,并检测到错误:

如果选择了“类别”,则“子类别”不起作用。 当我移除ng时,如果它有效

代码:


任何
总是
后处理
类别
类别:
子类别:

始终在ng模型中使用对象。由于
ng if
创建子作用域,您的原语绑定将中断。您可以将
ng if
替换为
ng show
,作为解决方法。是否解决了此问题?
            <div class="form-group">
                <div class="row-fluid"><label><input type="radio" ng-model="banner.visibility" value="0" /> any</label></div>
                <div class="row-fluid"><label><input type="radio" ng-model="banner.visibility" value="1" /> always</label></div>
                <div class="row-fluid"><label><input type="radio" ng-model="banner.visibility" value="2" /> aftering</label></div>
                <div class="row-fluid"><label><input type="radio" ng-model="banner.visibility" value="3" /> category</label></div>

                <div class="row-fluid" ng-if="banner.visibility==3">
                    <div class="col-md-6">
                        <label class="control-label">category:</label>
                        <div>
                            <select
                                    class="form-control"
                                    ng-options="category.title for category in categories"
                                    ng-model="currentCategory"
                                    ng-change="shopBannerCtrl.loadSubcategories()"
                            ></select>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <label class="control-label">Subcategory:</label>
                        <div>
                            <select class="form-control" ng-options="subcategory.title for subcategory in subcategories" ng-model="currentSubcategory"></select>
                        </div>
                    </div>
                </div>
            </div>