Groups API used
authoraditya-nambiar <aditya.nambiar007@gmail.com>
Mon, 16 Jun 2014 20:47:12 +0000 (16:47 -0400)
committeraditya-nambiar <aditya.nambiar007@gmail.com>
Sat, 26 Jul 2014 04:48:16 +0000 (10:18 +0530)
js/angular-crmMailingAB.js
partials/abtesting/helloworld.html

index 609f3100c9103670a4136db7c3de63a75ef04a63..332d5a4149f3741a2e8abc63946b904fb0552d0c 100644 (file)
                 templateUrl: partialUrl('helloworld.html'),
                 controller: 'TabsDemoCtrl',
                 resolve: {
+                    metaData: function($route, crmApi) {
+                        return crmApi('Group', 'get', {});
+                    },
                     mailingList: function($route, crmApi) {
                         return crmApi('Mailing', 'get', {});
-                    },
-                    allgroups: function($route,crmApi){
-                        return crmApi('Group','get',{});
                     }
 
                 }
 
 
             });
+
+
         }
     ]);
 //-----------------------------------------
     // Add a new record by name.
     // Ex: <crmAddName crm-options="['Alpha','Beta','Gamma']" crm-var="newItem" crm-on-add="callMyCreateFunction(newItem)" />
 
-    crmMailingAB.controller('TabsDemoCtrl', function($scope, crmApi, mailingList) {
+    crmMailingAB.controller('TabsDemoCtrl', function($scope, crmApi, metaData, mailingList) {
 
+        $scope.groups = metaData.values;
+        $scope.mailings = mailingList.values;
         $scope.adi=0;
         $scope.campaign_clicked= function(){
             if($scope.adi >= 0 ){
 
            link: function(scope,element, attrs){
 
-              $(document).ready(function() { $(element).select2({width:"400px",placeholder: "Select the groups you wish to include"});
+               $(element).select2({width:"400px",placeholder: "Select the groups you wish to include"});
+               $(element).select2("data",groups)
+
+
 
-              });
 
            }
        };
index 3da00ae097245f96824e8b4dabbaf97707235836..d9eed593ce031fe2ee5c586ffa8a66cde8c40836 100644 (file)
@@ -5,9 +5,11 @@
 
 
     <ul>
-        <li ng-repeat="a in allgroups">a.name</li>
+        <li ng-repeat="a in groups">{{a.title}}</li>
+    </ul>
+    <ul>
+        <li ng-repeat="b in mailings">{{b.name}}</li>
     </ul>
-
     <div ui-jq="tabs" id="alltabs" >
 
         <ul>
                     <h3 style="text-decoration: underline;">Select the groups you would like to add</h3><br>
 
 
-                    &nbsp<select multiple id="e1" groupselect required name ="grps" required>
-                        <option value="AL">Mumbai</option>
-                        <option value="AL">Delhi</option>
-                        <option value="AL">Madras</option>
-                        <option value="AL">Kanpur</option>
-                        <option value="WY">Kharagpur</option>
+                    &nbsp<select multiple  groupselect required name ="grps" required ng-model="groups_selected">
+                        <option ng-repeat="grp in groups" value={{grp.title}} >{{grp.title}}</option>
+
                     </select><br><br>
                     <p ng-show=" impform.grps.$pristine" >You name is required.</p>
 
             </tr>
              <tr>
                  <td>Groups Selected</td>
-                 <td></td>
+                 <td>{{groups_selected}}</td>
              </tr>
              <tr>
                  <td>Size of Test Group</td>