`

@绑定

阅读更多
	<div my-directive
	my-url="http://google.com"
	my-link-text="Click me to go to Google"></div>

	angular.module('myApp', [])
	.directive('myDirective', function() {
		return {
			restrict: 'A',
			replace: true,
			scope: {
			myUrl: '@', //绑定策略
			myLinkText: '@' //绑定策略
			},
			template: '<a href="{{myUrl}}">' +
			'{{myLinkText}}</a>'
		};
	});

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics