在这里,我想在c#中实现部分类的概念,以便在多个物理文件之间分割代码。
我尝试如下,但它不适合我。
<div ng-app="appmods" ng-controller="parentctrl">
<input type="text" ng-model="name" />
{{name}}
<input type="text" ng-model="age" />
{{age}}
<input type="button" ng-click="showlog()" value="save" />
</div>
Js.File
var appmod = angular.module('appmods',[]);
appmod.controller('firstctrl',function($scope) {
var vm = this;
$scope.name = "phani";
// code
console.log($scope)
return vm;
})
appmod.controller('ChildCtrl',function( $scope,$controller) {
var vm = $controller('firstctrl', {
$scope: $scope,
options: {}
});
// extend view model
vm.name = '';
vm.age = 12;
vm.showlog = function () {
console.log('hello');
console.log($scope);
}
return vm
})