[SOLVED] Template7 + Firebase array date


#1

Hello, I’m using firebase and template7 for my queries, the detail is when I save a solution in firebase and at the moment this is printed, it should be 4 radio.

array firebase

The code that I am using is this

data: function() {
  return {
    plan_estudio: [],
    loading: true,
  }
},
on: {
  pageInit: function() {

     var self = this;
    var app = self.$app;
    let _plan_estudio = [];


    var carreras = db.collection("plan de estudio");
    carreras.get().then(function(querySnapshot) {

        querySnapshot.forEach(function(doc) {
          
          console.log(doc.id, "=>", doc.data().grupos);
        
           _plan_estudio.push({
             carrera: doc.id,
             grupos: doc.data().grupos
           })
           self.$setState({
             plan_estudio: _plan_estudio,
           });
           self.$setState({
             loading: false
           });
        });

      })
      .catch(function(error) {
        console.log("Error getting documents: ", error);
      });
  },
},

and I send it to print here

        {{#each plan_estudio}}

          <li class="accordion-item"><a href="#" class="item-content item-link">
              <div class="item-inner">
                <div class="item-title">{{carrera}}</div>
              </div>
            </a>
            <div class="accordion-item-content">
              <div class="list">
                <ul>
                  <li>
                    <label class="item-radio item-content">
                      <input type="radio" name="grupo" value="{{grupos}}" />
                      <i class="icon icon-radio"></i>
                      <div class="item-inner">
                        <div class="item-title">{{grupos}}</div>
                      </div>
                    </label>
                  </li>
                </ul>
              </div>
            </div>
          </li>
        {{/each}}

#2

Your plan_estudio.grupos contains array from what i see, what is the issue? If you need to have checkbox for each, then you also need to do {{each grupos}}


#4

Thank you very much I really appreciate it from my heart. <3