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