@绑定

	<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>'
		};
	});

猜你喜欢

转载自ruanqiangbeyond201208043532.iteye.com/blog/2355139