Skip to content
Loading
how to bind Data to HTML control in angularjs with routing.
  1. var app = angular.module("myApp", ["ngRoute"])  
  2.      
  3.                  app.config(["$routeProvider""$locationProvider"function ($routeProvider, $locationProvider) {  
  4.                      $routeProvider.when('/home', {  
  5.                          templateUrl: 'Home/home',  
  6.                          controller: 'homecontroller'  
  7.                      })  
  8. .controller("homecontroller"function ($scope, $location) {  
  9.                      $scope.message = "home controller";  
  10.                      $scope.Name = "Junaid";  
  11.                  }) 
 In above code iam trying to bind $scope.Name into my html control in home page.And home page is partial page in mvc something like this....
  1. @{  
  2.     Layout = null;  
  3. }  
  4. {{message}}

      
  5. "text" ng-model="Name" />  
  6. home page

     
 
 If Iam wrong please correct me.Thnak you...

3 Replies

Know the answer? Post it — somebody with the same question will find it here.