Created
January 27, 2014 20:48
-
-
Save gabrielmiller/8657004 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Periods in object keys</title> | |
</head> | |
<body ng-app="example" ng-controller="exampleController"> | |
<h1>Array with periods in its objects' keys</h1> | |
<input type="text" ng-model="someInput['a.word']"></input> | |
<ul> | |
<li ng-repeat="(itemKey, item) in data | filter: someInput"> | |
<p>{{item['a.word']}}, {{item['b.word']}}</p> | |
</li> | |
</ul> | |
<hr> | |
<h1>Array without periods in its objects' keys</h1> | |
<input type="text" ng-model="someInput2['aword']"></input> | |
<ul> | |
<li ng-repeat="(itemKey, item) in data2 | filter: someInput2"> | |
<p>{{item['aword']}}, {{item['bword']}}</p> | |
</li> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.js"></script> | |
<script type="text/javascript"> | |
var example = angular.module('example', []); | |
example.controller('exampleController', ['$scope', function exampleController($scope){ | |
$scope.someInput = {}; | |
$scope.data = [ | |
{ | |
"a.word": "alphabet", | |
"b.word": "books" | |
}, | |
{ | |
"a.word": "apple", | |
"b.word": "banana" | |
}, | |
{ | |
"a.word": "anthrax", | |
"b.word": "beta blockers" | |
}, | |
{ | |
"a.word": "ask.com", | |
"b.word": "bing.com" | |
}, | |
{ | |
"a.word": "ankle", | |
"b.word": "bicep" | |
} | |
]; | |
$scope.someInput2 = {}; | |
$scope.data2 = [ | |
{ | |
"aword": "alphabet", | |
"bword": "books" | |
}, | |
{ | |
"aword": "apple", | |
"bword": "banana" | |
}, | |
{ | |
"aword": "anthrax", | |
"bword": "beta blockers" | |
}, | |
{ | |
"aword": "ask.com", | |
"bword": "bing.com" | |
}, | |
{ | |
"aword": "ankle", | |
"bword": "bicep" | |
} | |
]; | |
}]); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment