Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.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 - Fatal编程技术网

如何创建;这";AngularJs中的对象?

如何创建;这";AngularJs中的对象?,angularjs,Angularjs,我有一张姓名和身份证的清单。我已经用ng repeat属性显示了它。我想在单击时在1秒内显示相应的id和名称 $scope.showFn = function() { $scope.showPopup = true; $timeout(function(){ console.log("timeout"); $scope.showPopup = false; }, 1000); }; 我已经创建了一个plunker 现在只需单击一下即可显示所有id。请帮忙谢谢。请尝试

我有一张姓名和身份证的清单。我已经用ng repeat属性显示了它。我想在单击时在1秒内显示相应的id和名称

$scope.showFn = function() {
  $scope.showPopup = true;
  $timeout(function(){
    console.log("timeout");
    $scope.showPopup = false;
  }, 1000);
};
我已经创建了一个plunker




现在只需单击一下即可显示所有id。请帮忙
谢谢。

请尝试以下HTML格式:

<!DOCTYPE html>
<html ng-app="app">

  <head>
    <script data-require="angular.js@*" data-semver="1.3.0-beta.5" src="https://code.angularjs.org/1.3.0-beta.5/angular.js"></script>
    <link rel="stylesheet" href="style.css" />
    <script src="script.js"></script>
  </head>

  <body ng-controller="main">
    <ul>
      <li ng-repeat="item in items">
        <a href="#" ng-click="showFn(item.id)">{{item.name}}</a>
        <span ng-show="showPopup && item.id == shownId">{{item.id}}</span>
      </li>
    </ul>
  </body>

</html>

在HTML中尝试以下内容:

<!DOCTYPE html>
<html ng-app="app">

  <head>
    <script data-require="angular.js@*" data-semver="1.3.0-beta.5" src="https://code.angularjs.org/1.3.0-beta.5/angular.js"></script>
    <link rel="stylesheet" href="style.css" />
    <script src="script.js"></script>
  </head>

  <body ng-controller="main">
    <ul>
      <li ng-repeat="item in items">
        <a href="#" ng-click="showFn(item.id)">{{item.name}}</a>
        <span ng-show="showPopup && item.id == shownId">{{item.id}}</span>
      </li>
    </ul>
  </body>

</html>