how to use if in a function in knockout js?

后端 未结 3 1399
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-29 05:42

i have a condition in my function . i want to set a value of a variable true or false on the basis of another variable whether it is empty of not in knockout js?



        
3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-29 06:06

    The way you have it written you would need

    self.editData = function (data) { 
       self.id(data.id);
       self.nscto(data.nscto);
       if (self.nscto() != null && self.nscto() == ""){
            self.view(true);
       }
    }
    

提交回复
热议问题