<!doctype html>
<html ng-app="myApp">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js"></script>
<script>
var str =
[ { url: 'http://maedakobe.rw.xsi.jp/javascript/javascript.html',
title: '超初心者のプログラム入門(JavaScript)'
},
{ url: 'http://www.eonet.ne.jp/~maeda/cs/cs.html',
title: '超初心者のプログラム入門(C#)'
},
{ url: 'http://www.eonet.ne.jp/~maeda/cpp/cpp.htm',
title: '超初心者のプログラム入門(C/C++)'
},
{ url: 'http://maedakobe.rw.xsi.jp/php/php.html',
title: '超初心者のプログラム入門(PHP)'
},
];
var app = angular.module('myApp', []);
app.controller('myController', function($scope)
{ $scope.members = str;
$scope.onSrh = function()
{ $scope.key = $scope.srh;
};
});
</script>
</head>
<body>
<form ng-controller="myController">
<input id="srh" type="text" ng-model="srh" />
<button ng-click="onSrh()">Search</button><br>
<input id="key" type="text" ng-show="" />
<div ng-show="key" ng-repeat="member in members | filter:srh">
<a ng-href="{{member.url}}">
{{member.title}} </a>
</div>
</form>
</body>
</html>
|