1. AngularJS default value for ng-model

    Use ng-init for setting default value.
    The $scope.value.attr would be created as variable by setting default. If default is not set for value.attr the variable 'attr' would be created in $scope.value unless some value is input by user.

<td class="dataLabel">
<input name="Attr" type="text" value="5" ng-model="value.attr" ng-init="value.attr=0" />
<span class="fieldComment">

4. Scope variables in controller

Define variable
$scope.value= {};

$scope.value.attr = {};

Define array

$scope.value.comments = [];

5. Loop over scope in controller

$scope.coords = []; 
angular.forEach($ , function(value){ 

  #Wait for REST API Get call to finish before logging for 200 ms
  setTimeout( function(){ 
  }, 200); 

6. ng components checkbox

7. Nested Model

    Define nested model

    Define nested model serializer 

    There are 5 things to take care.
    1. Define ManytoMany in Model

        product = models.ManyToManyField(ScheduleProduct)

    2. Define many in serializer
    3. Define create function in serializer
    4. Set id in objects.create to prevent 'id not null error'.
    5. Evaluate if read-only is needed.
        owner = ownerSerializer(many=False, read_only=False)

        class ScheduleSerializer(serializers.ModelSerializer):
    product = ScheduleProductSerializer(many=True,)
    oss = ScheduleOperatingSystemSerializer(many=True,)
    class Meta:
        model = Schedule
        fields = ("id","description","cleanRunner","haltCompletion","createSnapshot","deleteScheduleOnCompletion","priority","product","oss","idEPO")
    def create(self, validated_data):
        product_data = validated_data.pop('product')
        oss_data = validated_data.pop('oss')
        schedule = Schedule.objects.create(**validated_data)
        for product in product_data:
            pt = ScheduleProduct.objects.create(idProduct=product.get("idProduct"))
            pt.idProduct = product.get("idProduct")
   = product.get("name")
            pt.check = product.get("check")
        for oss in oss_data:
            ot = ScheduleOperatingSystem.objects.create(idOS=oss.get("idOS"))
            ot.idOS = oss.get("idOS")
   = oss.get("name")
            ot.check = oss.get("check")
        return schedule