Mobile Application _NameList&Address

41

 

เปิดโปรแกรม
สร้าง new folder = MyApp2
สร้าง folder NameList ด้วยคำสั่ง
>ionic start NameList blank
>ionic serve
เข้าไปใน folder NameList เปิดไฟล์ด้วย open with Atom
เข้าไปแก้ใน www . folder index html และ add.js ดัง โปรแกรมด้านล่าง

Index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title></title>
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">    -->
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>
<!-- your app's js -->
<script src="js/app.js"></script>
</head>
<body ng-app="starter">
<ion-pane>
<ion-header-bar class="bar-stable">
<h1 class="title">PEOPLE LIST</h1>
</ion-header-bar>
<ion-content ng-controller="MyCon">
<div class="list list-inset">

<label class="item item-input">
<li class="icon ion-search placeholder-icon"></i>
<input type="text" placeholder="Search" ng-model="PEOPLE_FILTER">
</label>
</div>
<div class="list">
<a class="item item-avatar" href="#" ng-repeat="item in PEOPLE_LIST | filter:PEOPLE_FILTER" >
<img ng-src="{{item.IMG}}">
<h2>  {{item.NAME}}       </h2>
<h2>  {{item.FULL_NAME}}  </h2>
<p>    {{item.PHONE}}      </p>
</a>
</div>
</ion-content>
</ion-pane>
</body>
</html>
---------------------------------------------------------------------
Add.js
angular.module('starter', ['ionic'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
});
})
.controller("MyCon", function($scope) {
$scope.PEOPLE_LIST = [
{ID: 1,IMG :'img/1.jpg',NAME: 'Dave', FULL_NAME : 'DAVID HAJDYLA',PHONE : '001 589 6364587'},
{ID: 2,IMG :'img/2.jpg',NAME: 'Rich', FULL_NAME : 'RICHARD ALGORE', PHONE : '001 356 90888'},
{ID: 3,IMG :'img/3.jpg',NAME: 'Tom', FULL_NAME : 'TOM GUTZ',PHONE : '007 378 6892333'},
{ID: 4,IMG :'img/4.jpg',NAME: 'Sae', FULL_NAME : 'SAEYOUNG PARK', PHONE : '001 374 9069834'},
{ID: 5,IMG :'img/5.jpg',NAME: 'Pat', FULL_NAME : 'PIRATRA BREIFUL',PHONE : '069 456 9076239'}
];
});
--------------------------------------------------
copy รูปภาพใส่ไว้ใน C:\Users\Meow\Desktop\MyApp2\NameList\www\img
ที่โปรแกรมอยู่

c5

Bookmark the permalink.

Comments are closed.