Próbuję usunąć atrybuty href lub NG-href z kątowym (v1.2.28) dyrektywyUsuwanie href z kątowym dyrektywy
to działa dobrze, gdy adres URL nie ma w nim ciąg interpolacji.
Czy możesz mi pomóc rozwiązać ten problem?
właśnie popełnił jsfiddle tutaj http://jsfiddle.net/gfvewv5u/1/
angular.module('ui.directives', []);
angular.module('ui', ['ui.directives']);
angular.module('ui.directives', []).directive('uiTool',
function() {
return {
restrict: 'EAC',
require: '?ngModel',
link: function($scope, element, attrs, controller) {
var controllerOptions, options;
attrs.$set('href', null);
element.removeAttr('href');
element.text('iamfoo for what');
}
};
});
angular.module('myApp', ['ui.directives'])
.controller('testCtrl', function($scope){
$scope.val = 1;
});
i HTML
<div ng-app="myApp">
<div ng-controller="testCtrl">
<a ui-tool href="/test/ts/{{val}}" >Link need to be removed</a>
<a ui-tool href="/test/ts" >Link remove</a>
</div>
</div>
oparciu o moim przykładzie pierwszym ogniwem wciąż mam href podczas 2nd Link doens't
Już określone kątową moduł angular.module ('ui.directives', []) ;. Tak więc usuń [] z angular.module ("ui.directives", []). Dyrektywa ("uiTool", – intekhab