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>
3、实现结果