I have created a list of Items using the following code:
<html ng-app="ionicApp">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title> Creators </title>
<link href="http://code.ionicframework.com/nightly/css/ionic.css" rel="stylesheet">
<script src="http://code.ionicframework.com/nightly/js/ionic.bundle.js"></script>
<script>
angular.module('ionicApp', ['ionic'])
.controller('MyCtrl', function($scope) {
$scope.items = [
{
"id": "1",
"name": "Steve Jobs"
},
{
"id": "2",
"name": "Bill Gates"
}
];
});
</script>
</head>
<body ng-controller="MyCtrl">
<ion-header-bar class="bar-positive">
<h1 class="title">Smart List</h1>
</ion-header-bar>
<ion-content>
<ion-list>
<ion-item ng-repeat="item in items" item="item">
{{ item.name }}
</ion-item>
</ion-list>
</ion-content>
</body>
</html>
Here is what I am getting:
But now I would like to open another html
page where I can show detail
of tapped list item, like : Id and Name in case of above example
you can achieve this using stateProvider. Here is the example of chats list and chat detail In which when you click on particular chat, chat details will be shown in chat details page. Here is app.js file which includes two controllers.
Here is Html page's body code.
You can call a function on click of item like following
In controller:
Using this you can show details of clicked item on new screen.
Here is the working plunker with some corrected changes ! Cheers to @Nimsesh Patel for creating this.
New html
In your controller
In main html where ng-repeat is there