Angularjs 我需要显示ng模型的值,但未更新

Angularjs 我需要显示ng模型的值,但未更新,angularjs,Angularjs,我试图在{totalReceitas}中显示我在ng model=“rendimentosocialinserco”中输入的相同值,但它没有更新,我做错了什么 PS:那是在一个表单中,不知道你为什么要这样做,但这就是你所缺少的 (function() { var app = angular.module("caiApp"); var cDiaController = function($scope,$log) { $scope.totalReceitas=$scop

我试图在{totalReceitas}中显示我在ng model=“rendimentosocialinserco”中输入的相同值,但它没有更新,我做错了什么


PS:那是在一个表单中,不知道你为什么要这样做,但这就是你所缺少的

    (function() {

  var app = angular.module("caiApp");

  var cDiaController = function($scope,$log) {

    $scope.totalReceitas=$scope.RendimentoSocialInsercao;

 };

  app.controller("cDiaController",['$scope','$log',cDiaController]);

}());

您需要观察其他变量的变化。
    (function() {

  var app = angular.module("caiApp");

  var cDiaController = function($scope,$log) {

    $scope.totalReceitas=$scope.RendimentoSocialInsercao;

 };

  app.controller("cDiaController",['$scope','$log',cDiaController]);

}());
(function() {

  var app = angular.module("caiApp");

  var cDiaController = function($scope,$log) {
    $scope.$watch("RendimentoSocialInsercao", function(newVal, oldVal) {
      $scope.totalReceitas=newVal;
    });    
 };

  app.controller("cDiaController",['$scope','$log',cDiaController]);

}());