Angular Meteor Interpolation is not responding to the "MainController"


#1

a) client/lib/app.js

angular.module(‘directives’, [‘angular-meteor’, ‘ui.router’]);
var app = angular.module(‘app’,[ ]);
angular.module(‘controllers’, [ ]).controller(‘MainController’, function($scope){
$scope.val = "test123"
})

b) client/index.html

In this file I have the interpolation inside a div with ng-controller=“MainController”
{{ val }}
closing div here.

Why the interpolation is not showing test123 ?
Thanks for your time and wisdom.


#2

Is the app bootstrapped somewhere?

Also your app module doesn’t depend on the controllers module…


#3

I am a total newie integrating Angular with Meteor…

I have the following file

Meteor.startup(function () {
if (Tutors.find().count() === 0) {

  var tutors = [
    {'name': 'Dubstep-Free Zone',
      'description': 'Fast just got faster with Nexus S.'},
    {'name': 'All dubstep all the time',
      'description': 'Get it on!'},
    {'name': 'Savage lounging',
      'description': 'Leisure suit required. And only fiercest manners.'}
  ];
  for (var i = 0; i < tutors.length; i++)
    Tutors.insert({name: tutors[i].name, description: tutors[i].description});
}

});


#4

When you are using {{ }} you have to use the .ng.html files, otherwise it will conflict with Blaze.

To fix your problem while still using .html files you can do this:

<div ng-bind="val"></div>

#5

Thanks so much Uri. It worked nicely! I have been studying your angular-meteor videos that I could recognize your voice on the street. :smile:

This is a question to the community:

When I run this code in Angular-Meteor within the index.html, the ng-model works well showing the “firstName” but if I call the ng.html file with (div ui-view)(/div) to the index.html the name does not show.

             <div ng-init="firstName='John'">
		<p>Input something in the input box:</p>
		<p>Name: <input type="text" ng-model="firstName"></p>
		<p>You wrote: <div ng-bind="firstName"></div></p>
	</div>

Any wisdom to share?
SOLVED::: the new controller I created was the blockage. I tested with ParitesListCtrl and worked,