1、實例背景
ionic是基於AngularJS,是一個框架。根據AngularJS雙向綁定變量,動態獲取值。
2、實作源碼
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <title>ionic之简单实例</title> <link rel="stylesheet" href="../css/ionic.css" /> <script type="text/javascript" src="../js/ionic.bundle.js" ></script> <script> var app = angular.module("tagApp",["ionic"]); app.controller("tagController",function($scope){ $scope.username = "李海"; }); </script> </head> <body ng-app="tagApp" ng-controller="tagController"> <ion-header-bar class="bar-positive"> <label class="title">欢迎使用ionic</label> </ion-header-bar> <ion-content> <span>{{username}}</span> </ion-content> </body> </html>
相關內容請追蹤PHP中文網(m.sbmmt.com)!