Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.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 AngularJS“;ng重复“过滤器:…”;未按预期工作(未显示数据)_Javascript_Angularjs - Fatal编程技术网

Javascript AngularJS“;ng重复“过滤器:…”;未按预期工作(未显示数据)

Javascript AngularJS“;ng重复“过滤器:…”;未按预期工作(未显示数据),javascript,angularjs,Javascript,Angularjs,我想学一些英语。我有一个本地托管的小页面,可以在MySQL中查找信息。字段为[用户ID、注释、用户名] <div id="container" ng-app='two_way' ng-controller='two_way_control'> <input ng-model="name_filter" placeholder="filter names"> <p>{{name_filter}}</p> <div class

我想学一些英语。我有一个本地托管的小页面,可以在MySQL中查找信息。字段为[用户ID、注释、用户名]

<div id="container" ng-app='two_way' ng-controller='two_way_control'>
    <input ng-model="name_filter" placeholder="filter names">
    <p>{{name_filter}}</p>
  <div class="row" ng-repeat="data in profile_pictures | filter:{data.user_Name:name_filter}">
    <div class=".col-sm-6 .col-md-5 .col-lg-6" style="background-color:#eee;height:125px;width:500px;margin-left:240px;margin-top:20px;">
      <h4 style="padding:10px;">{{data.user_Name}} says:</h4><hr>
      <p style="padding:10px;">
        {{data.comment}}
      </p>
      <img src="{{data.profile_picture}}" class="img-circle" style="width:100px;height:100px;margin-left:-140px;margin-top:-130px;">
    </div>
  </div>
</div>
以下是网页的代码: AngularJS试验

<div id="container" ng-app='two_way' ng-controller='two_way_control'>
    <input ng-model="name_filter" placeholder="filter names">
    <p>{{name_filter}}</p>
  <div class="row" ng-repeat="data in profile_pictures | filter:{data.user_Name:name_filter}">
    <div class=".col-sm-6 .col-md-5 .col-lg-6" style="background-color:#eee;height:125px;width:500px;margin-left:240px;margin-top:20px;">
      <h4 style="padding:10px;">{{data.user_Name}} says:</h4><hr>
      <p style="padding:10px;">
        {{data.comment}}
      </p>
      <img src="{{data.profile_picture}}" class="img-circle" style="width:100px;height:100px;margin-left:-140px;margin-top:-130px;">
    </div>
  </div>
</div>

<div id="container" ng-app='two_way' ng-controller='two_way_control'>
    <input ng-model="name_filter" placeholder="filter names">
    <p>{{name_filter}}</p>
  <div class="row" ng-repeat="data in profile_pictures | filter:{data.user_Name:name_filter}">
    <div class=".col-sm-6 .col-md-5 .col-lg-6" style="background-color:#eee;height:125px;width:500px;margin-left:240px;margin-top:20px;">
      <h4 style="padding:10px;">{{data.user_Name}} says:</h4><hr>
      <p style="padding:10px;">
        {{data.comment}}
      </p>
      <img src="{{data.profile_picture}}" class="img-circle" style="width:100px;height:100px;margin-left:-140px;margin-top:-130px;">
    </div>
  </div>
</div>

{{name_filter}}

<div id="container" ng-app='two_way' ng-controller='two_way_control'>
    <input ng-model="name_filter" placeholder="filter names">
    <p>{{name_filter}}</p>
  <div class="row" ng-repeat="data in profile_pictures | filter:{data.user_Name:name_filter}">
    <div class=".col-sm-6 .col-md-5 .col-lg-6" style="background-color:#eee;height:125px;width:500px;margin-left:240px;margin-top:20px;">
      <h4 style="padding:10px;">{{data.user_Name}} says:</h4><hr>
      <p style="padding:10px;">
        {{data.comment}}
      </p>
      <img src="{{data.profile_picture}}" class="img-circle" style="width:100px;height:100px;margin-left:-140px;margin-top:-130px;">
    </div>
  </div>
</div>
{{data.user_Name}}说:

{{data.comment}

<div id="container" ng-app='two_way' ng-controller='two_way_control'>
    <input ng-model="name_filter" placeholder="filter names">
    <p>{{name_filter}}</p>
  <div class="row" ng-repeat="data in profile_pictures | filter:{data.user_Name:name_filter}">
    <div class=".col-sm-6 .col-md-5 .col-lg-6" style="background-color:#eee;height:125px;width:500px;margin-left:240px;margin-top:20px;">
      <h4 style="padding:10px;">{{data.user_Name}} says:</h4><hr>
      <p style="padding:10px;">
        {{data.comment}}
      </p>
      <img src="{{data.profile_picture}}" class="img-circle" style="width:100px;height:100px;margin-left:-140px;margin-top:-130px;">
    </div>
  </div>
</div>

<div id="container" ng-app='two_way' ng-controller='two_way_control'>
    <input ng-model="name_filter" placeholder="filter names">
    <p>{{name_filter}}</p>
  <div class="row" ng-repeat="data in profile_pictures | filter:{data.user_Name:name_filter}">
    <div class=".col-sm-6 .col-md-5 .col-lg-6" style="background-color:#eee;height:125px;width:500px;margin-left:240px;margin-top:20px;">
      <h4 style="padding:10px;">{{data.user_Name}} says:</h4><hr>
      <p style="padding:10px;">
        {{data.comment}}
      </p>
      <img src="{{data.profile_picture}}" class="img-circle" style="width:100px;height:100px;margin-left:-140px;margin-top:-130px;">
    </div>
  </div>
</div>
现在我遇到的问题是关于“个人资料图片中的数据”的过滤器

<div id="container" ng-app='two_way' ng-controller='two_way_control'>
    <input ng-model="name_filter" placeholder="filter names">
    <p>{{name_filter}}</p>
  <div class="row" ng-repeat="data in profile_pictures | filter:{data.user_Name:name_filter}">
    <div class=".col-sm-6 .col-md-5 .col-lg-6" style="background-color:#eee;height:125px;width:500px;margin-left:240px;margin-top:20px;">
      <h4 style="padding:10px;">{{data.user_Name}} says:</h4><hr>
      <p style="padding:10px;">
        {{data.comment}}
      </p>
      <img src="{{data.profile_picture}}" class="img-circle" style="width:100px;height:100px;margin-left:-140px;margin-top:-130px;">
    </div>
  </div>
</div>
我正在尝试仅按用户名字段进行筛选。当我在站点的输入框中键入任何内容时,不会显示任何数据(所有内容都会消失)。我已经尝试将过滤器硬编码为我知道在数据中的名称,但在我加载页面时没有显示任何数据

<div id="container" ng-app='two_way' ng-controller='two_way_control'>
    <input ng-model="name_filter" placeholder="filter names">
    <p>{{name_filter}}</p>
  <div class="row" ng-repeat="data in profile_pictures | filter:{data.user_Name:name_filter}">
    <div class=".col-sm-6 .col-md-5 .col-lg-6" style="background-color:#eee;height:125px;width:500px;margin-left:240px;margin-top:20px;">
      <h4 style="padding:10px;">{{data.user_Name}} says:</h4><hr>
      <p style="padding:10px;">
        {{data.comment}}
      </p>
      <img src="{{data.profile_picture}}" class="img-circle" style="width:100px;height:100px;margin-left:-140px;margin-top:-130px;">
    </div>
  </div>
</div>
有什么想法吗

<div id="container" ng-app='two_way' ng-controller='two_way_control'>
    <input ng-model="name_filter" placeholder="filter names">
    <p>{{name_filter}}</p>
  <div class="row" ng-repeat="data in profile_pictures | filter:{data.user_Name:name_filter}">
    <div class=".col-sm-6 .col-md-5 .col-lg-6" style="background-color:#eee;height:125px;width:500px;margin-left:240px;margin-top:20px;">
      <h4 style="padding:10px;">{{data.user_Name}} says:</h4><hr>
      <p style="padding:10px;">
        {{data.comment}}
      </p>
      <img src="{{data.profile_picture}}" class="img-circle" style="width:100px;height:100px;margin-left:-140px;margin-top:-130px;">
    </div>
  </div>
</div>

感谢您的帮助

您的筛选器中有无效语法。您需要提供对象的键名作为筛选器对象,不要对对象键@
filter:{data.user\u name:name\u filter}“

<div id="container" ng-app='two_way' ng-controller='two_way_control'>
    <input ng-model="name_filter" placeholder="filter names">
    <p>{{name_filter}}</p>
  <div class="row" ng-repeat="data in profile_pictures | filter:{data.user_Name:name_filter}">
    <div class=".col-sm-6 .col-md-5 .col-lg-6" style="background-color:#eee;height:125px;width:500px;margin-left:240px;margin-top:20px;">
      <h4 style="padding:10px;">{{data.user_Name}} says:</h4><hr>
      <p style="padding:10px;">
        {{data.comment}}
      </p>
      <img src="{{data.profile_picture}}" class="img-circle" style="width:100px;height:100px;margin-left:-140px;margin-top:-130px;">
    </div>
  </div>
</div>
i、 e尝试

<div id="container" ng-app='two_way' ng-controller='two_way_control'>
    <input ng-model="name_filter" placeholder="filter names">
    <p>{{name_filter}}</p>
  <div class="row" ng-repeat="data in profile_pictures | filter:{data.user_Name:name_filter}">
    <div class=".col-sm-6 .col-md-5 .col-lg-6" style="background-color:#eee;height:125px;width:500px;margin-left:240px;margin-top:20px;">
      <h4 style="padding:10px;">{{data.user_Name}} says:</h4><hr>
      <p style="padding:10px;">
        {{data.comment}}
      </p>
      <img src="{{data.profile_picture}}" class="img-circle" style="width:100px;height:100px;margin-left:-140px;margin-top:-130px;">
    </div>
  </div>
</div>
ng-repeat="data in profile_pictures | filter:{user_Name:name_filter}"

是的,这就是解决方案!我习惯于使用VBA和SQL Server,因此我错过了点表示法问题。感谢您的帮助