我必须制作类似全局功能的东西,但我在某处犯错,任何人都可以看到并帮助我解决这个问题:
<div>
<p class="comment-name">{{getName}}</p>
<p class="comment-mail">{{getMail}}</p>
<div class="comment_content">
<p class="comment-com">{{getComm}}</p>
<button class="post-comm" ng-click="postCom()">Post</button>
</div>
AngularJS:
myApp.run(function ($rootScope) {
$rootScope.postCom = function () {
$rootScope.getName = $rootScope.name;
$rootScope.getMail = $rootScope.mail;
$rootScope.getComm = $rootScope.comment;
};
});