从输入获取整数值并通过ng-repeat创建引导面板 [英] Get integer value from input and create bootstrap panel by ng-repeat

查看:16
本文介绍了从输入获取整数值并通过ng-repeat创建引导面板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在基于Itinerary Organizer进行社交网络项目,并且我是Angular中的初学者..我想从输入中获取价值,并通过将值传递给ng-repeat属性来动态创建面板.是四个输入,并通过单击按钮生成一组输入..我正在共享面板和输入的图像..谢谢

i am working on social network project which base on Itinerary Organizer and i am beginner level in Angular.. i want to get value from input and create Panels dynamically by pass value to ng-repeat attribute.. and that single Panel should be four inputs and generate set of inputs by clicking a button.. i am sharing the image of panel and inputs..Thank you

推荐答案

为ZimSystem答复添加了+1.

Added +1 for ZimSystem reply.

我将再增加一点,将动态面板代码移至angular指令.这将使将来的扩展变得容易.观看此演示演示 https://plnkr.co/edit/EpUTeiLgHWPr1YFAwSys?p=preview

I will just add one more point, move your dynamic panel code to angular directive. This will keep make any future extension easy. See this for a demo https://plnkr.co/edit/EpUTeiLgHWPr1YFAwSys?p=preview

angular.module('docsTemplateUrlDirective', [])
.controller('Controller', ['$scope', function($scope) {
  $scope.NoOfDays = "";
  $scope.Days = [];
  $scope.Add = function()
  {
    $scope.Days = [];
    if($scope.NoOfDays != "")
    {
      for(i=0; i < $scope.NoOfDays;i++)
      $scope.Days.push(i);
    }
    $scope.NoOfDays = "";
    };
}])
.directive('myCustomer', function() {
  return {
    //your dynamic panel html 
    templateUrl: 'my-customer.html'
  };
});

这篇关于从输入获取整数值并通过ng-repeat创建引导面板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆