Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.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
Angularjs 如何在手风琴中添加表单。_Angularjs_Twitter Bootstrap - Fatal编程技术网

Angularjs 如何在手风琴中添加表单。

Angularjs 如何在手风琴中添加表单。,angularjs,twitter-bootstrap,Angularjs,Twitter Bootstrap,我是新的角度,当用户点击accordion标题,然后accordion正文显示表单。而不是在正文中显示html代码。我添加表单标签是否正确,如果其他请让我知道。提前感谢。 <div ng-controller="AccordionDemoCtrl"> <label class="checkbox"> <input type="checkbox" ng-model="oneAtATime"> Open only one at a time </l

我是新的角度,当用户点击accordion标题,然后accordion正文显示表单。而不是在正文中显示html代码。我添加表单标签是否正确,如果其他请让我知道。提前感谢。

<div ng-controller="AccordionDemoCtrl">
<label class="checkbox">
<input type="checkbox" ng-model="oneAtATime">
    Open only one at a time
</label>

<accordion close-others="oneAtATime">
<accordion-group heading="Static Header">
      This content is straight in the temmplate.
</accordion-group>
<accordion-group heading="{{group.title}}" ng-repeat="group in groups">
      {{group.template}}
</accordion-group>
<accordion-group heading="Dynamic Body Content">
<p>The body of the accordion group grows to fit the contents</p>
<button class="btn btn-small" ng-click="addItem()">Add Item</button>
<div ng-repeat="item in items">{{item}}</div>
</accordion-group>
</accordion>
</div>
</body>
<script>
angular.module('pl', ['ui.bootstrap']);
function AccordionDemoCtrl($scope) {
$scope.oneAtATime = true;

$scope.groups = [
{
title: "Member application",
template: '<form><input type="text"></form>'
},
{
title: "Contact us",
template:'<form> <input type="text"><input type="password"> </form>'   
}
];

$scope.items = ['Item 1', 'Item 2', 'Item 3'];

$scope.addItem = function() {
var newItemNo = $scope.items.length + 1;
$scope.items.push('Item ' + newItemNo);
};
}

</script>
</html>

一次只打开一个
此内容在示例中是直接的。
{{group.template}}
手风琴组的主体会随着内容的增长而增长

<div ng-controller="AccordionDemoCtrl">
<label class="checkbox">
<input type="checkbox" ng-model="oneAtATime">
    Open only one at a time
</label>

<accordion close-others="oneAtATime">
<accordion-group heading="Static Header">
      This content is straight in the temmplate.
</accordion-group>
<accordion-group heading="{{group.title}}" ng-repeat="group in groups">
      {{group.template}}
</accordion-group>
<accordion-group heading="Dynamic Body Content">
<p>The body of the accordion group grows to fit the contents</p>
<button class="btn btn-small" ng-click="addItem()">Add Item</button>
<div ng-repeat="item in items">{{item}}</div>
</accordion-group>
</accordion>
</div>
</body>
<script>
angular.module('pl', ['ui.bootstrap']);
function AccordionDemoCtrl($scope) {
$scope.oneAtATime = true;

$scope.groups = [
{
title: "Member application",
template: '<form><input type="text"></form>'
},
{
title: "Contact us",
template:'<form> <input type="text"><input type="password"> </form>'   
}
];

$scope.items = ['Item 1', 'Item 2', 'Item 3'];

$scope.addItem = function() {
var newItemNo = $scope.items.length + 1;
$scope.items.push('Item ' + newItemNo);
};
}

</script>
</html>
添加项 {{item}} angular.module('pl',['ui.bootstrap']); 函数AccordionDemoCtrl($scope){ $scope.oneAtATime=true; $scope.groups=[ { 标题:“会员申请”, 模板:“” }, { 标题:“联系我们”, 模板:“” } ]; $scope.items=['Item 1'、'Item 2'、'Item 3']; $scope.addItem=函数(){ var newItemNo=$scope.items.length+1; $scope.items.push('Item'+newItemNo); }; }
您将函数称为控制器,但它不是,它很奇怪。如果打算将其作为控制器,则不应使用它操纵DOM。在这样的范围内添加表单是错误的,在html中添加表单有什么错?如果你想了解如何构建一个关注点分离的角度应用程序,请查看我的github repo,你将函数称为控制器,但它不是,它很奇怪。如果打算将其作为控制器,则不应使用它操纵DOM。在这样的范围内添加表单是错误的,在html中添加表单有什么错?如果您想了解如何构建一个关注点分离的角度应用程序,请查看my github repo