报错:
angularjs:
var app = angular.module('MyApp', []);
 app.controller('testA', ['$scope', 'remoteData' , function($scope, remoteData){
     console.log ('come in controller');
     $scope.getData = function(){
         console.log('name:' + remoteData.name + '  value:' + remoteData.value);
     }
 }]);
 app.factory('remoteData', function(){
     var data = {name:'n', value:'v'};                                     
     return data;
 })
HTML:
<p ng-app='MyApp'>
    <p ng-controller="testA">                                               
      <button ng-click="getData()">sdd</button>
    </p>
</p>
                            
                                    Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
是我参数名配置的问题,确实代码没问题,谢谢回答的两位。
这个应该没问题,你看下版本