0
내 HAML 파일 :AngularJS와 : 삼항 연산자 조건 검사에서 기능 통화
%pipes-autocomplete{:model =>"filter.value",:option => "validate_option(filter)" ? "dependant(filter)" : "filter.option"}
내 커피 스크립트 :
$scope.validate_option =(filter)->
console.log "called validate_option"
if filter.hasOwnProperty('option') && filter.option.indexOf('dependant') > -1
return true
else
return false
$scope.dependant =(cal)->
return "choosed"
나는 validate_option 기능에 정의 된 호출 할 노력하고있어 삼항 연산자에서 내 함수가 호출되지 않습니다. 누군가이 문제를 도와 줄 수 있습니까?
3 진 연산자는 문자열을 참으로 간주합니다 (공백이 아니기 때문에). validate_option (filter)? dependent (filter) : filter.option "'(모두 하나의 문자열)을 시도해보십시오. 그러면 문자열이 평가 될 때까지 삼항 연산자의 실행을 연기 할 수 있습니다. – trincot
@ 트렁크 정말 고마워요. 괜찮아. 난 모르는 새비데. 너의 설명으로 내 의심이 사라졌어. –