View Binding Issue Using Data Returned From Factory

前端 未结 1 1006
傲寒
傲寒 2021-01-26 17:27

When I am calling AngularJs factory method to bind a list of months with static array then it is working fine. But when I am using MVC Controller to return same data then $scope

相关标签:
1条回答
  • 2021-01-26 18:10

    Extract the data from the promise with its .then method:

    //Functions
    function homeController($scope,$http, DataFactory,DataService) {
        $scope.headingText = "Home";
    
        DataFactory.getMonths().then(function(data) {
            $scope.months = data;
        });
    }
    
    0 讨论(0)
提交回复
热议问题