如何使用 angular js 在 Ionic App 中添加数据和数据流

How to add data and data flow in Ionic App using angular js

AngularJS 我想创建一个生日贺卡列表,其中我 select 我的朋友列表来自 JSON 我 select 朋友的文件和填写日期。 我在 index.html 中显示我的好友列表为

<!-- immutable scripts added -->
<script src="js/immutable.min.js"></script>

<ion-content class="has-subheader" >

  <!-- card list declaration -->
   <ul class="card">
      <!-- checkBox Declaration and filtering by search box -->
      <li class="item item-thumbnale-left" ng-repeat="item in items | filter:query">


           <!-- show friends list in cards  -->
            <input type="text" ng-model ="friend.Name" 
                ng-init = "friend.Name = item.Name" readonly/> 

            <!-- take a input field for taking friend b'day date --> 
              <div class="item item-input-inset">

                <!-- click a checkbox for add friend -->
                    <label class="checkbox">
                      <input type="checkbox" ng-click ="saveOrDelBirthday(friend)" 
                         ng-show = "friend.Date" ng-model = "friend.check"/>
                    </label>

                     <label class="item-input-wrapper">
                         <input type="date"  placeholder="Enter Date" 
                            ng-model = "friend.Date" />
                    </label>

              </div>


      </li> 
   </ul>
  </ion-content>

当我单击 显示 按钮时,新的 list.html 会显示所有 select 好友列表及其生日,但是 我的 selected 好友列表未显示在 list.html 文件为

<ion-content>
   <ul class="card">
      <li class="item" ng-repeat="(key,value) in information">
         <div style="float: left">{{ key }}</div>
          <div style="float: center">{{ value }}</div>
      </li> 

   </ul>
    <label class="item">

   // this is for sending mail to me from my app
      <button class="button button-positive" type="submit" ng-click = "sendMailMe()" >Confirm</button> 
    </label>

我使用不可变数据结构在 immutable.Map({}) 中存储具有键值对的数据; 我不知道我哪里错了。

//my controller contain this method

$scope.information = {}; //storing data from map
var friendMap = Immutable.Map({}); //declaring Map for inserting data in key value pair
$scope.friendMap1;

//this section decide which operation perform

$scope.saveOrDelBirthday = function(friend){

  console.log(friend.check);

  if(friend.check){

   friendMap1 = friendMap.set(friend.Name,friend.Date); //insert friend information
  }
  else{
      friendMap1 = friendMap.delete(friend.Name); //delete friend information

  }

  information = friendMap1.toObject();    
  console.log(information);
};

看起来 ng-repeat 指令期望的 $scope.information 没有在您的控制器中定义或返回一个空的 list/object。