<!doctype html>
<html>
<head>
<meta charset=utf-8"/>
<title>scope nick</title>
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<script type="text/javascript">
angular.module('app', [])
.controller('parentCtrl', ['$scope', function($scope) {
$scope.args= 'Nick DeveloperWorks';
}])
.controller('childCtrl', ['$scope', function($scope) {
$scope.args= 'Nick DeveloperWorks for test';
}]);
</script>
<body ng-app="app">
<div ng-controller="parentCtrl">
<input ng-model="args">
<div ng-controller="childCtrl">
<input ng-model="args">
</div>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<meta charset=utf-8"/>
<title>scope nick</title>
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<script type="text/javascript">
angular.module('app', [])
.controller('parentCtrl', ['$scope', function($scope) {
$scope.args = 'Nick DeveloperWorks';
}])
.controller('childCtrl', ['$scope', function($scope) {
}]);
</script>
<body ng-app="app">
<div ng-controller="parentCtrl">
<input ng-model="args">
<div ng-controller="childCtrl">
<input ng-model="args">
</div>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<meta charset=utf-8"/>
<title>scope nick</title>
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<script type="text/javascript">
angular.module('app', [])
.controller('parentCtrl', ['$scope', function($scope) {
$scope.args = {};
$scope.args.content = 'Nick DeveloperWorks';
}])
.controller('childCtrl', ['$scope', function($scope) {
}]);
</script>
<body ng-app="app">
<div ng-controller="parentCtrl">
<input ng-model="args.content">
<div ng-controller="childCtrl">
<input ng-model="args.content">
</div>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<meta charset=utf-8"/>
<title>scope nick</title>
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<script type="text/javascript">
angular.module('app', [])
.controller('parentCtrl', ['$scope', function($scope) {
$scope.args = {};
$scope.args.content = 'Nick DeveloperWorks';
}])
.controller('childCtrl', ['$scope', function($scope) {
$scope.args = {};
$scope.args.content = 'Nick DeveloperWorks for test';
}]);
</script>
<body ng-app="app">
<div ng-controller="parentCtrl">
<input ng-model="args.content">
<div ng-controller="childCtrl">
<input ng-model="args.content">
</div>
</div>
</body>
</html>
angular.module('isolate', []).directive("isolate", function () {
return {
scope : {},
};
})
<!doctype html>
<html>
<head>
<meta charset=utf-8"/>
<title>scope nick</title>
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<script type="text/javascript">
angular.module('app', [])
.controller('ctrl', ['$scope', function($scope) {
$scope.args = {};
}])
.directive("isolateDirective", function () {
return {
scope : {},
link : function($scope, $element, $attr) {
console.log($scope.$args); //输出 undefined
}
};
});
</script>
<body ng-app="app">
<div ng-controller="ctrl">
<div isolate-directive></div>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<meta charset=utf-8"/>
<title>scope nick</title>
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<script>
angular.module('isolateScope', [])
.directive("isolateDirective", function () {
return {
replace : true,
template: '<button>{{isolates}}</button>',
scope : {
isolates : '@',
},
link : function($scope, $element, $attr) {
$scope.isolates = "DeveloperWorks";//无效
}
};
})
.controller("ctrl", function ($scope) {
$scope.btns = 'NICK';
});
</script>
<body ng-app="isolateScope" >
<div ng-controller="ctrl">
<button>{{btns}}</button>
<div isolate-directive isolates="{{btns}}"></div>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<meta charset=utf-8"/>
<title>scope nick</title>
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<script>
angular.module('isolateScope', [])
.directive("isolateDirective", function () {
return {
replace : true,
scope : {
isolates : '&',
},
link : function($scope, $element, $attr) {
var func = $scope.isolates();
func();
}
};
})
.controller("ctrl", function ($scope) {
$scope.func = function () {
console.log("Nick DeveloperWorks");
}
});
</script>
<body ng-app="isolateScope" >
<div ng-controller="ctrl">
<div isolate-directive data-isolates="func"></div>
</div>
</body>
</html>
<!doctype html>
<html>
<head>
<meta charset=utf-8"/>
<title>scope nick</title>
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<script>
angular.module('isolateScope', [])
.directive("isolateDirective", function () {
return {
replace : true,
template: '<button>{{isolates}}</button>',
scope : {
isolates : '=',
},
link : function($scope, $element, $attr) {
$scope.isolates.name = "NICK";
}
};
})
.controller("ctrl", function ($scope) {
$scope.btns = {
name : 'nick',
dw : 'DeveloperWorks'
};
});
</script>
<body ng-app="isolateScope" >
<div ng-controller="ctrl">
<button>{{btns.dw}}</button>
<button>{{btns.name}}</button>
<div isolate-directive data-isolates="btns"></div>
</div>
</body>
</html>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有