지시어 값에 따라 적절한 템플릿을 렌더링하는 지시문이 있습니다. 양식 파트를 렌더링합니다. 나는 그들을 모으고 어떤 변화에 대해 평가하고 싶다. 내가 지시 오 승/NG 변화를 사용하는 경우angularjs template ng-change not called
은, 모든 템플릿을 불러 NG 변화가 템플릿 안에되는 경우가 아닌 한, 잘 동작하는 것.
지침은 더 적은이 다음과 같습니다
myApp.directive('render', function() {
return function (scope, element, attrs) {
return attrs.$observe('parameters', function (value) {
var attributes, options, renderValue;
attributes = scope.$eval("{" + attrs.parameters + "}");
renderValue = attrs.render;
if (renderValue === "input") {
return {
restrict: 'E',
replace: true,
template: element.html('<label for="' + element.text() + '">' + element.text() + ' </label><input name="' + element.text() + '" type=' + attributes.type + ' class="large-12 columns" ng-model="' + element.text() + '" ng-change="change()">')
};
}
})
}
});
그것은 좀 더 다른 등등 선택, 라디오를 렌더링의 경우가 있습니다. 그러나 아이디어는 같습니다.
Here is the jsfiddle which shows my problem.
난에 어떤 도움을 주셔서 감사합니다.
편집 jsfiddle에
잘못된 페이스트, 지금 수정.
당신이 무엇을 요구 확실하지. 분명히 게시 된 바이올린이 질문과 일치하지 않습니다. – zsong
링크가 수정되었습니다. –