0
<html ng-app="san">
<head>
</head>
<body ng-controller="sanctrl">
<div>
AngularJS</div>
<div ng-view="">
</div>
<button type="button" ng-click="init()" class="btn btn-blue">
Save</button>
</body>
</html>
主控制器:
san.controller('sanctrl', function ($scope, $http, $q, $location, $anchorScroll, $filter, dataFactory) {
//nothing in this controller.
});
NG-视图控制器:
san.app.controller('cereals', function ($scope, dataFactory) {
$scope.init(){
$scope.test = "test";
};
});
我试图调用从外部纳克视点范围init方法。可能吗?如果不是,那么我们有什么选择?
真棒:) :)为我工作 –
伟大的东西! :) – lulu88