returning and calling an object in a list (ANGULAR.js)

前端 未结 3 1449
遥遥无期
遥遥无期 2021-01-22 16:22

in this example I\'m returning a string depending on whether a text field is a value for \"beast\" and/or \"color\". but this is only returning a string. I would return in two c

3条回答
  •  轮回少年
    2021-01-22 16:45

    Look at this

     app.service('myFactoryService', function(){
      this.createObj = function(name,type){
        var obj = {};
        obj.name = name;
        obj.type = type;
        return obj;
      }
    });
    
    results.push(myFactoryService.createObj(item.beast,"animal"));
    

    I don't know somehow why two-way binding doesn't permit to show two variables differently, only object, but there is defined service to create an object, then it is created in filter according to both options.

提交回复
热议问题