for reason data dosent show when can see in main.html putting data in table.. meteor app, dont worry angular installed using node, have meteor on computer. followed this tutorial
main.html:
<body> <div ng-controller="partieslistctrl"> <table border = 1> <tr ng-repeat = "data in parties"> <td>{{data.name}}</td> <td>{{data.description}}</td> </tr> </table> </div> </body>
index.html:
<body ng-app="socially"> <div ng-include src="'main.html'"></div> </body>
app.js:
if (meteor.isclient) { angular.module('socially', ['angular-meteor']); angular.module('socially').controller('partieslistctrl',["$scope", function ($scope) { $scope.parties = [ { 'name': 'dubstep-free zone', 'description': 'can please evening not listen dubstep.' }, { 'name': 'all dubstep time', 'description': 'get on!' }, { 'name': 'savage lounging', 'description': 'leisure suit required. , fiercest manners.' } ]; }] ); }
your code should below.
angular.module('socially', ['angular-meteor']) .controller('partieslistctrl',["$scope", function ($scope) { $scope.parties = [ { 'name': 'dubstep-free zone', 'description': 'can please evening not listen dubstep.' }, { 'name': 'all dubstep time', 'description': 'get on!' }, { 'name': 'savage lounging', 'description': 'leisure suit required. , fiercest manners.' } ]; }] );
changes
remove second instance of angular.module('socially') , directly use .controller or assign variable , use controller below.
var socially = angular.module('socially', ['angular-meteor']); socially.controller('partieslistctrl',["$scope", function ($scope) { //your controller code goes here. }]);
do let me know if doesn't work.
angular.module('socially', []) .controller('partieslistctrl',["$scope", function ($scope) { $scope.parties = [ { 'name': 'dubstep-free zone', 'description': 'can please evening not listen dubstep.' }, { 'name': 'all dubstep time', 'description': 'get on!' }, { 'name': 'savage lounging', 'description': 'leisure suit required. , fiercest manners.' } ]; }] );
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <body ng-app="socially"> <div ng-controller="partieslistctrl"> <table border = 1> <tr ng-repeat = "data in parties"> <td>{{data.name}}</td> <td>{{data.description}}</td> </tr> </table> </div> </body>
Comments
Post a Comment