I'm working on a project in Rails that also uses AngularJS.
First of all, I have a variable called @resource that contains an end time

```
<input style="display:none" ng-model="remainingTime" ng-init="remainingTime = <%= (resource.available_until.to_f - DateTime.now.to_f).to_i %>">

```

This obtains the remaining time for an X task and is displayed as follows (without display none).

[![A input with a remaining time](https://i.stack.imgur.com/au9OI.png)](https://i.stack.imgur.com/au9OI.png)

That value obtained I must access it from the controller.

In the controller I have the following:

```
 function UserEvaluationsNewCtrl ($log, $scope) {
    console.log($scope.remainingTime)
}

```

When I want to access from the controller, the variable show "undefined" :/

Any help is useful. Thank you!!!

Edited:

console.log($scope):
[![enter image description here](https://i.stack.imgur.com/h5tDu.png)](https://i.stack.imgur.com/h5tDu.png)

remainingTime=-39698

-The negative number is correct-

Edited 2:
Complete controller:

```
;(function () {
  'use strict';

  // Define controller
  function UserEvaluationsNewCtrl ($log, $scope) {
    $log.debug('UserEvaluationsNewCtrl: Hi')
    var vm = this

    vm.data = angular.extend({}, rails_data || {})
    vm.evaluationData = vm.data.resource
    vm.evaluationDataStringified = ''

    $scope.$watch(function(){
      return vm.evaluationData
    }, function(newValue, oldValue){
      vm.evaluationDataStringified = angular.toJson(newValue)
      $log.debug('ResourcesNewCtrl: $watch vm.evaluationDataStringified: to JSON output:', vm.evaluationDataStringified)
    }, true)

    console.log($scope)
  }

  // Inject dependencies
  UserEvaluationsNewCtrl.$inject = ['$log', '$scope']

  // Register controller
  angular
    .module('app.controllers.user_evaluations.new', [])
    .controller('UserEvaluationsNewCtrl', UserEvaluationsNewCtrl)
})();

```