Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I have this code in my angular js controller .

angular.module('IpadAppApp')
    .controller('Mortgage_LoanCtrl', function ($location, $scope, $http, $modal, $sce) {

    var host = 'http://localhost:3000';
    var applicantID;

    $scope.submit_info = function(size) {
    $http.post(url, data, { withCredentials: true, headers: { 'Accept': 'application/javascript', 'Content-Type': 'application/x-www-form-urlencoded;'} })
      .success(function (caseID) {
            var modalInstanceSubmit = $modal.open({
                templateUrl: 'views/mortgage_loan/home_loan_thank_you.html',
                controller: 'Mortgage_LoanCtrl',
                size: size      
                });
                applicantID = caseID;       
        })
  };

   $scope.thank_you_page = function(thank_you_page_data) {
        return $sce.trustAsHtml(thank_you_page_data);
    };

I want to pass the applicantID into my html page

<div class="ls-case-id"> Your case ID is:  {{applicantID}} </div>

But it is not passing any data i then tried

In my home_loan_thank_you.html

<p ng-bind-html='thank_you_page(bodyinfo)'></p>

Also passing empty data. So how do i pass applicantID to view or how can i delcare global variables in angularjs controller. I have tried the option of putting above my module or controller declaration and also not putting var in front of the variable name but all to no avail works.

Thanks

share|improve this question

If I understand your question correctly, you require variable applicantID to bind with html. In order to bind the variable with html, you should use $scope. So instead of declaring var applicantID ,declare it as a scope variable like $scope.applicantID which will bind the applicantID data to the html

share|improve this answer
    
tried with $scope too doesnt work as well @gopinath – Kingsley Simon Feb 10 '15 at 7:29
    
can u provide your code in jsFiddle, so that it would be easy and clear for me to check why it is not working. – Gopinath Shiva Feb 10 '15 at 7:41
    
here it is jsfiddle.net/boyfunky/u0nhwa4w – Kingsley Simon Feb 10 '15 at 8:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.