1

When trying to insert an embedded document, what should the angular view look like?

This is my model in node:

var ArticleSchema = new Schema({
  /*other fields that aren't relavent here */
  allowed_countries:[CountrySchema]
});

var CountrySchema = new Schema({
  country: {
    type: String,
    default: '',
    trim: true
  }
});

This is what I tried for the Angular View:

<div class="control-group">
  <label class="control-label" for="allowed_countries.country">Allowed Countries</label>
  <div class="controls">
    <input type="text" data-ng-model="allowed_countries.country" id="allowed_countries.country">
  </div>
</div>

Obviously, this isn't working but I'm not sure why how are you supposed to sort out the view for a subdocument in Angular (my google-fu is failing me)

Any help would be appreciated.

4
  • sorry, what do you want to achieve / what should the view perform? Commented Nov 28, 2013 at 16:51
  • Sorry, this is from the create view. I want to insert the country into the allowed_countries array. For now, I only need to do it for one country but I'm not certain how to structure it. Commented Nov 28, 2013 at 16:57
  • should this insertion be permanent into DB (if so how it should be triggered)? Commented Nov 28, 2013 at 17:00
  • Yes. This is created when the document is created. If I change the allowed_countries field into a string ads change the data-ng-model and id to allowed_countries then the entire document is created without issue. Commented Nov 28, 2013 at 17:14

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.