My code:
Its simple but i don't get want am i missing:
<div ng-app="sample" ng-init="firstName='somnath'">
<p>My name is: <span ng-bind="firstName"></span>
</p>
</div>
First thing two ng-app
on same page will not work, Always 1st one is read by angular. you need to use angular.bootstrap
to initialize angular on two elements.
Markup
<div id="app">
<p>Name:
<input type="text" ng-model="name" />
</p>
<h1 ng-bind="name" />
</div>
<div id="app1" ng-init="firstName='somnath'">
<p>My name is: <span ng-bind="firstName"></span>
</p>
</div>
Code
var app = angular.module('app',[])
var app1 = angular.module('app1',[])
angular.element(document).ready(function() {
angular.bootstrap(document.getElementById('app'), ['app']);
angular.bootstrap(document.getElementById('app1'), ['app1']);
});