(function() {
'use strict';
angular.module('myApp')
.controller('mrSearchCtrl', function($scope, $http, $timeout) {
$scope.keyword = null;
var userToken = JSON.parse(localStorage.getItem("userInfo"));
$scope.SearchMrHistory = function(){
var searchData = {
'keyword': $scope.keyword
};
$http.post("url?requestToken=" + userToken.token + "&start=0&end=5", searchData)
.success(function(searchData, status) {
// alert("searched");
for(var i=0; i < searchData.length; i++)
$scope.patientName = searchData[i].patientName;
console.log("Patient Name" + $scope.patientName);
能够在控制台中查看此patientName,但不在视图中,我的视图如下:
<div class="list" ng-controller="mrSearchCtrl">
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input placeholder="Search MR" id="SearchMrDetail" type="text" ng-model="keyword">
</label>
<button class="button" ng-click="SearchMrHistory()">Search</button>
</div>
</div>
<ion-list>
<span ng-show="patientName"> Searched Name : {{patientName}} </span>
NOTHING正在观看,它是空的,请帮忙。