标签: ng-repeat

Angular-ui Bootstrap工具提示未在ng-repeat中显示(node-webkit app)

我是angular.js和node-webkit的新手,我正在努力使引导工具提示在通过ng-repeat动态加载的内容中工作.

首先,我尝试使用标准引导程序并执行以下操作:http: //jsfiddle.net/nsDFe/3/

app.directive('bsTooltip', function () {
    return function (scope, element, attrs) {
        // trying to register the new tooltips
        element.find('span').tooltip();
    };
});
Run Code Online (Sandbox Code Playgroud)

这不起作用(但第一个表行中的"通常"定义的工具提示有效).

然后我尝试使用angular-ui bootstrap并做了以下(认为它应该是一种"自动",角度库将听取新的dom元素):http: //jsfiddle.net/XTG8k/2/

但也没有运气.有人能指出我正确的方向吗?我在Stackoverflow上看到了一些关于这方面的讨论,但没有一个真正解决了我的问题.我听说过对$ compile的一些含糊的引用,但是无法想出如何实现它.

tooltip twitter-bootstrap angularjs ng-repeat angular-ui-bootstrap

1
推荐指数
1
解决办法
8221
查看次数

使用ng-repeat时如何在特定行的angularjs中隐藏<td>

我有一张桌子和许多<td>s,<tr> </tr>我首先使用的是ng-repeat

  <tr ng-repeat="receipt in $data">
   <td   data-title="voucher number">
    <span>{{receipt.voucher_no}}</span> 
   </td>
    <td   data-title="voucher date" sortable="'voucher_date'" filter="{'voucher_date': 'text' }">
    <span>{{receipt.voucher_date}}</span> 
   </td>
    <td   data-title="voucher Amount">
    <span>{{receipt.voucher_amount}}</span> 
   </td> 
  </tr>  
Run Code Online (Sandbox Code Playgroud)

我也有json数据

{
    "data": [
        {
            "voucher_no": "2",
            "voucher_amount": "100",
            "voucher_date": "2014-05-04",
      },
        {
            "voucher_no": "3",
            "voucher_amount": "1000000",
            "voucher_date": "2014-02-05",
        },
        {
            "voucher_no": "4",
            "voucher_amount": "50000",
            "voucher_date": "2014-02-05",
        },
        .
        .
        .
        .
        {
            "total": 1360100
        }
    ]
}

please note that for final data there is only one field …
Run Code Online (Sandbox Code Playgroud)

javascript angularjs angularjs-directive ng-repeat

1
推荐指数
1
解决办法
5584
查看次数

如何在按钮上移动对象内部按钮单击?

我在ng-repeat中有一个很棒的项目列表,每个项目都有一个向上和向下按钮.我只想要向上按钮将列表项向上移动一个位置,向下按钮应将其向下移动一个位置.问题是我收到一条错误,上面写着"无法读取未定义的属性'NaN'." 似乎"位置"在第二行未定义.我该怎么做才能解决这个问题?

继承人我正在使用的javascript(感谢Rishul Matta):

$scope.moveUp = function(ind, position) {
       $scope.temp = $scope.list[position - 1];
       $scope.list[position - 1] = $scope.list[position];
       $scope.list[position = temp];
  };
Run Code Online (Sandbox Code Playgroud)

这是我的HTML:

<ul>
  <li class="steps" ng-repeat="step in selectedWorkflow.Steps track by $index" ng-class="{'words' : step.Id != selectedStep.Id, 'selectedWords' : step.Id == selectedStep.Id}" ng-model="selectedWorkflow.Step" ng-click="selectStep(step, $index); toggleShow('showSubStep'); toggleShow('showEditBtn')">
      {{step.Name}}
      <input class="orderUpBtn" type="button" ng-click="moveUp($index, step)" style="z-index:50" value="U" />
      <input class="orderDownBtn" type="button" style="z-index:50" value="D" /> 
  </li>
</ul>
Run Code Online (Sandbox Code Playgroud)

谢谢!

angularjs ng-repeat

1
推荐指数
1
解决办法
4584
查看次数

根据ng-repeat项目计数动态设置元素宽度

我是新手使用AngularJS 1.4.x.

<div class="colContainer" ng-repeat="item in betNumber" ng-style="{width:{{rowWidth(item.length)}} +'px'}">
Run Code Online (Sandbox Code Playgroud)

当按下AddNumber球超过13时,我希望宽度大小可以调整大小.这是我的希望 在此输入图像描述

我希望可以动态改变div宽度大小,如何让它工作正常???

这是我的希望http://plnkr.co/edit/t8bBjE?p=preview

angularjs ng-repeat ng-style

1
推荐指数
1
解决办法
2692
查看次数

将数据传递到ng-repeat中的离子弹出窗口

我想将离子Popover添加到我的应用程序中并置于ng-repeat下但是我对此有点挣扎.

如何将参数传递给它?

<p ng-repeat="query in ctrl.timesheet">query.Name<button ng-click="openPopover($event)">Open Popover</button></p>

<script id="my-popover.html" type="text/ng-template">
  <ion-popover-view>
    <ion-header-bar>
      <h1 class="title">My Popover Title</h1>
    </ion-header-bar>
    <ion-content>
      <button ng-click="ctrl.delete(index)">Delete</button>
    </ion-content>
  </ion-popover-view>
</script>
Run Code Online (Sandbox Code Playgroud)

所以简而言之我想要一个按钮列表,每当我点击按钮的弹出窗口时,都会有一个删除元素的选项.

angularjs ng-repeat ionic

1
推荐指数
1
解决办法
3302
查看次数

ng-repeat没有以正确的格式生成结果

我是angularjs的新手并且正致力于创建示例应用程序.我正在使用ng-repeat指令.我的控制器看起来像这样:

app.controller('CustomerController',function ($scope) {
    $scope.customers = [{ Name: 'Emp One' }, { Age: 10 }, { Salary: 100000000 },
    { Name: 'Emp Two' }, { Age: 20 }, { Salary: 2000000 },
    { Name: 'Emp Three' }, { Age: 30 }, { Salary: 300000000 }];

    $scope.AddCustomer = function() {
        $scope.customers.push($scope.NewCutomer.Name, $scope.NewCutomer.Age, $scope.NewCutomer.Salary);
    };
})
Run Code Online (Sandbox Code Playgroud)

现在在视图中我只是打印输出.

<div ng-repeat="cust in customers">
    <p>Name:   {{cust.Name}}  Age:  {{cust.Age}}   Salary: {{cust.Salary}}</p>   
</div>
Run Code Online (Sandbox Code Playgroud)

看下面的图像,而不是产生3行,系统产生9行.

在此输入图像描述

我希望输出像

Name: EmpOne Age: 10 Salary: 10000000
Name: EmpTwo Age: 30 …
Run Code Online (Sandbox Code Playgroud)

angularjs ng-repeat angularjs-ng-repeat

0
推荐指数
1
解决办法
40
查看次数

如何将AngularJS ng-repeat变量传递给Javascript点击事件

我想知道如何将Angular ng-repeat变量传递给我的Javascript onclick事件

我的角度转发器

       <div class="data" data-ng-repeat="sub in subs" >  
            <button onclick="ConfirmDialog(sub.SubID)">Cancel</button>
            {{ sub.someOtherProperty}}
            {{ sub.someOtherProperty}}
            {{ sub.someOtherProperty}}                
        </div>
Run Code Online (Sandbox Code Playgroud)

我的脚本功能

<script type='text/javascript'>

    function ConfirmDialog(subID) {
             console.log('Succesfully submitted id: ', subID);
    });
 </script>
Run Code Online (Sandbox Code Playgroud)

错误:sub未定义(在按钮元素的onclick()调用中)所有其他属性显示为预期.

javascript parameter-passing angularjs ng-repeat

0
推荐指数
1
解决办法
1万
查看次数

你会怎么重复这个

我还想使用ng-repeat显示键"scott"和"bill"及其所有属性值(fullname和age).

{
    "attributes": {
        "scott": {
            "fullname": "Scott D Man",
            "age": "string"
        },
        "bill": {
            "fullname": "William Shatner",
            "age": "string"
        }
    },
    "id": "HJK321",
    "reportDate": "20150719"
}
Run Code Online (Sandbox Code Playgroud)

angularjs ng-repeat

0
推荐指数
1
解决办法
50
查看次数

如何仅在ng-repeat的最后一项添加ng-click事件?

我想在项目列表的最后一项上添加点击事件.

 <li ng-repeat="item in items" ng-click="myFunction" >{{item.name}}</li>

    $scope.myFunction = function(){
     // logic here...
    }
Run Code Online (Sandbox Code Playgroud)

angularjs ng-repeat angularjs-ng-click

0
推荐指数
1
解决办法
880
查看次数

404仅在第一张图像中,在离子/角度的重复重复中找不到图像

所以我使用以下代码在我的html页面上输出一些图像

<div ng-repeat="Object in Objects"><img src="{{Object.Image}}"></div>
Run Code Online (Sandbox Code Playgroud)

这很好用,可以循环我所有的图像对象,一切都很棒.但是我在控制器中设置了$ scope.Objects变量.因此,当我第一次启动我的网页时,我找不到404

http://192.168.1.180:8100/%7B%7BObject.Image%7D%7D
Run Code Online (Sandbox Code Playgroud)

再一次,一切正常,我的所有图像都显示出来,但是我收到了几个404错误(我在几个地方这样做)并且我试图摆脱它们.

javascript angularjs ng-repeat angularjs-scope ionic

0
推荐指数
1
解决办法
1234
查看次数

checkBox ng-repeat from controller-data not Rendering:AngularJs

我从Controller文件中获取复选框数据,但它没有正确呈现.以下是我的HTML:

HTML:

<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
</head>
<body ng-app="myApp" ng-controller="myCtrl">
<table>
    <tr ng-repeat="x in People">
        <input type="checkbox" id="{{x.id}}" >{{x.name}}<br/> 
    </tr>
</table>
<button>Click</button>
<script>
//Module Declaration
var app = angular.module('myApp',[]);
//Controller Declaration
app.controller('myCtrl',function($scope){
    $scope.People = [
        {name:"Peter",id:"201"},
        {name:"Lina",id:"202"},
        {name:"Roger",id:"203"}
    ];
});
</script>
</body> 
</html>
Run Code Online (Sandbox Code Playgroud)

期望:

3行输入复选框,其名称与它们相邻

结果:

在此输入图像描述

没有JS错误.有人可以帮我解决这个问题吗?

javascript checkbox angularjs ng-repeat

0
推荐指数
1
解决办法
124
查看次数

离子载玻片,每个都与ng-repeat重叠

我是离子,html,角度和java脚本的真正新手.我有一个应用程序,它采用一些JSON数据并显示它ng-repeat.

但是当我试图切换到下一张幻灯片时,它会重叠.我有一个$ interval,每5秒刷新一次JSON,它也重置为第一张幻灯片.

这里的HTML:

<ion-view title="home">
<ion-content ng-controller="temperatureCtrl">        
  <div ng-init="init()"></div>
    <ion-slides  options="options" slider="data.slider" >
        <ion-slide-page ng-repeat="channel in channels">
          <div class="list">
            <h2><center>canal# {{channel.canal}}</center></h2>                   
            <br/>
            <center>
              <button class="button button-stable" ng-click="switchChannel(channel, channel.canal)" ng-model="channel.status">
                {{channel.status}}
              </button>
            </center>
            <div class="list">
              <label class="item item-input">            
                <input type="text" style="text-align:center;" placeholder="Channel name" ng-model="channel.name" ng-focus="stopRefresh()" ng-blur="restartRefresh()">
              </label>
            </div>
            <h4><center>
            <span class="Ainput" ><h3>{{channel.temperature}}&#186;C</h3></span>
            </center></h4>
            <h3><center>Setpoint= {{channel.setPoint}}</center></h3><br>
            <div class="item range range-positive">                  
              <i class="icon ion-minus-round"></i>                   
                <input type="range" name="setpoint" min="5" max="30" step="0.5" value="33" ng-model="channel.setPoint" ng-focus="stopRefresh()" ng-blur="restartRefresh()">
              <i class="icon ion-plus-round"></i>
            </div>
            <centrer>
              <button …
Run Code Online (Sandbox Code Playgroud)

angularjs ng-repeat ionic-framework

0
推荐指数
1
解决办法
855
查看次数

具有约束数据的嵌套ng-repeat

我有一个嵌套的ng-repeat如下:

<div ng-repeat="item_l in list1">
    <div ng-repeat="item_f in list2">
        {{item_f}} {{item_l}}
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

它给了我大约20个结果,但我只想要其中的5个.这该怎么做?

javascript angularjs ng-repeat angularjs-ng-repeat

0
推荐指数
1
解决办法
37
查看次数