Javascript ng repeat中的角度文件输入(引导)不起作用

Javascript ng repeat中的角度文件输入(引导)不起作用,javascript,html,angularjs,twitter-bootstrap,angularjs-ng-repeat,Javascript,Html,Angularjs,Twitter Bootstrap,Angularjs Ng Repeat,我有一个表,我通过行进行迭代,并显示编辑信息。在那里我有一个图像上传文件输入。文件输入是一个引导扩展,它提供了一个很好的接口。以下是链接: 它的用法很简单,您可以使用输入标记(如data show upload)中的属性定义输入组件,也可以使用jquery初始化组件,例如: $("#photo").fileinput({showCaption: false}); 这是我的桌子: <table id="table-brand" class="table" style="border-st

我有一个表,我通过行进行迭代,并显示编辑信息。在那里我有一个图像上传文件输入。文件输入是一个引导扩展,它提供了一个很好的接口。以下是链接:

它的用法很简单,您可以使用输入标记(如data show upload)中的属性定义输入组件,也可以使用jquery初始化组件,例如:

$("#photo").fileinput({showCaption: false}); 
这是我的桌子:

<table id="table-brand" class="table" style="border-style:none">
<tr>
    <td><b>Marka Adı</b></td>
    <td><b>Bilgi</b></td>
    <td><b>Aktif</b></td>
    <td><b>Logo</b></td>
</tr>
<tr name="brand" ng-repeat="brand in selectedCustomer.brands">
    <td><input name="name" type="text" class="form-control"
           id="field-brand-name"
           style="width:150px" value="" title="Vergi No"/></td>
    <td><textarea name="bio" type="text" class="form-control"
          id="field-brand-bio"
          style="width:150px" value="" title="Vergi No"></textarea></td>
    <td><input index="0" id="photo0" name="photo" type="file" class="file"
           accept=".jpg,.jpeg,.png" style="width:120px;"
           data-show-upload="false" data-show-caption="false"
           data-show-preview="false"/></td>
</tr>
</table>
但它不起作用。同样在不删除ng repeat的情况下,如果我将输入元素带到“”之外,它也可以工作

谢谢

编辑:我调试了该行

$(document).ready(function() { .. }
当代码在那里停止执行时,angular还没有呈现页面,所以查询不会返回任何内容,也不会执行初始值设定项

我需要一些函数,告诉angular在呈现页面或ng repeat后执行

用这个

 $(document).ready(function() {
       k();
    });


var k= function { $('#photo0').fileinput({showCaption: false, showPreview: false, showUpload: false});}

使用自定义指令运行jQuery代码。将指令放在输入字段上,并在指令的链接函数中运行制造

angular.module('moduleName')
    .directive('myDirective', function () {
    return {
        restrict: 'EA', //E = element, A = attribute, C = class, M = comment         
        scope: {
            //@ reads the attribute value, = provides two-way binding, & works with functions
            title: '@'         },
        template: '<div>{{ myVal }}</div>',
        templateUrl: 'mytemplate.html',
        controller: controllerFunction, //Embed a custom controller in the directive
        link: function ($scope, element, attrs) { } //DOM manipulation
    }
});
angular.module('moduleName'))
.directive('myDirective',函数(){
返回{
restrict:'EA',//E=element,A=attribute,C=class,M=comment
范围:{
//@读取属性值,=提供双向绑定,&与函数一起使用
标题:'@'},
模板:“{myVal}}”,
templateUrl:'mytemplate.html',
controller:controllerFunction,//在指令中嵌入自定义控制器
链接:函数($scope,element,attrs){}//DOM操作
}
});

您只需要上面的lunk函数,它为您提供了指令元素

尝试在控制器上创建一个函数,在输入的init上调用fileinput并传递输入id,如下所示

<input ng-init="myCtrl.init_input_file('your_file_input')" id="your_file_input" type="file">
在使用更改之前,尝试创建一个位置来分配文件输入


我用ng repeat解决了这个问题,它有一个没有时间的超时来等待HTML呈现。

我试过了,实际上它与我在问题中提到的没有什么不同$(文档)。ready函数在角度渲染之前执行,我需要一些函数在角度渲染之后执行。Blog了解指令如何工作->
<input ng-init="myCtrl.init_input_file('your_file_input')" id="your_file_input" type="file">
$my.init_input_file = function(id){
   $timeout(function(){
      $("#"+id).fileinput();
      $('#'+id).change(function(){
           $my.models.files[id] = this.files;
      });
   });
 };