I need sample code in anjualrjs

On Thu, Oct 4, 2018 at 6:13 PM mahesh reddy <[email protected]>
wrote:

> This is row add functionality
>
>     $scope.myData = [];
> //add functionality for each row
>
>   $scope.myData = [
>         {
>                  Id:"",
>                  ProductID:"",
>
>                  ProductName:"",
>
>                  CategoryID:"",
>                 CategortName: "",
>                   RAI_Item:"",
>                 RAI_ItemCode: "",
>                 RAI_Price: "",
>                 RAI_Quantity: "",
>                 RAI_Total: "",
>                 subitems:[{
>                     Id:'',
>                     text:'',
>                 }
>                 ]
>
>         }];
>
> could you please suggest me how to write subitems add functionality using
> above
>
> On Thu, Oct 4, 2018 at 6:08 PM Amit Shaw <[email protected]> wrote:
>
>> Hi Mahesh,
>>
>> I forgot to add the initAddress method.
>>
>> initAddress(data) {
>>     console.log("Data");
>>     console.log(data);
>>     if(data == '' || data === undefined){
>>     return this._fb.group({
>>       Project_Name__c: [''],
>>       Project_Name_2__c: [''],
>>       Capital_Required__c:[''],
>>       Financing_Structure__c:[''],
>>       Interested_formats_of_cooperation__c:[''],
>>       Investment_Round__c:[''],
>>       Project_Custom_Currency__c:[''],
>>       Project_Custom_Date_time__c:[''],
>>       Project_Custom_Number_1__c:[''],
>>       Project_Custom_Number_2__c:[''],
>>       Project_Custom_Picklist__c:[''],
>>       Project_Custom_Text__c:[''],
>>       Project_Custom_Text_2__c:[''],
>>       Project_Location__c:[''],
>>       Sectors__c:[''],
>>       Sub_Sectors__c:[''],
>>       Project_Description__c:[''],
>>       Project_Description_2__c:[''],
>>       Project_Custom_Rich_Text_Area__c:[''],
>>     });
>>   }
>>
>> Regards
>> Amit
>>
>> On Thu, Oct 4, 2018 at 6:06 PM Amit Shaw <[email protected]> wrote:
>>
>>> Hi Mahesh,
>>> Actually, in my project, I implemented like they can add project how
>>> much they want.
>>> First, they have to click on add project i am displaying a material
>>> popup and then one complete form fields and below add more project option
>>> is there.
>>> So they can add another form fields.
>>> I am sharing my code here.
>>>
>>> HTML
>>>
>>>   <form [formGroup]="myForm" novalidate (ngSubmit)="onSubmit(myForm)">
>>>           <!--addresses-->
>>>           <div formArrayName="project">
>>>             <div *ngFor="let address of
>>> myForm?.controls.project.controls; let i=index" class="panel panel-default">
>>>             <!--  <div class="panel-heading">
>>>                 <span>Project {{i + 1}}</span>
>>>                 <span class="glyphicon glyphicon-remove pull-right"
>>> *ngIf="myForm?.controls.project.controls.length > 1"
>>> (click)="removeProject(i)"></span>
>>>               </div> -->
>>>               <div class="panel-body" [formGroupName]="i">
>>>                 <div class="project-name-det">
>>>                 <div class="form-group col-xs-12"
>>> *ngIf="settings['Project Information'][16]?.biw.readaccess =='true'">
>>>                   <label for="label">{{settings['Project
>>> Information'][16]?.biw.labelname}}
>>>                     <span *ngIf="settings['Project
>>> Information'][16].biw.required == 'true'" class="required">*</span>
>>>                   </label>
>>>                   <input type="text" class="form-control"
>>> formControlName="Project_Name__c">
>>>                 </div>
>>>                 <div class="form-group col-xs-12"
>>> *ngIf="settings['Project Information'][17]?.biw.readaccess =='true'">
>>>                   <label>{{settings['Project
>>> Information'][17]?.biw.labelname}}
>>>                     <span *ngIf="settings['Project
>>> Information'][17]?.biw.required == 'true'" class="required">*</span>
>>>                   </label>
>>>                   <input type="text" class="form-control"
>>> formControlName="Project_Name_2__c">
>>>                 </div>
>>>               </div>
>>>                 <div class="form-group col-xs-6"
>>> *ngIf="settings['Project Information'][0]?.biw.readaccess =='true'">
>>>                     <label>{{settings['Project
>>> Information'][0]?.biw.labelname}}
>>>                       <span *ngIf="settings['Project
>>> Information'][0]?.biw.required == 'true'" class="required">*</span>
>>>                     </label>
>>>                     <input type="text" class="form-control"
>>> formControlName="Capital_Required__c">
>>>                 </div>
>>>           <div class="col-md-3 col-md-offset-9 action-section">
>>>               <button type="button" class="btn btn-primary"
>>> (click)="onSubmit()">Save</button>
>>>               <button type="button" class="btn btn-cancel"
>>> (click)="onCancel()">Cancel</button>
>>>             </div>
>>>           <div class="clearfix"></div>
>>>
>>>        <div class="margin-20">
>>>             <a (click)="addProject()" style="cursor: default">
>>>               Add another project +
>>>             </a>
>>>           </div>
>>>         </form>
>>>       </div>
>>>     </div>
>>>   </div>
>>> <!-- Edit project information
>>> <div class="container project-info-edit-section">
>>>   <div class="row">
>>>     <div class=" col-md-12 header-title">
>>>       <div class="title-text">Project information</div>
>>>     </div>
>>>     <form>
>>>
>>> TS file
>>> addProject() {
>>>   const control = <FormArray>this.myForm.controls['project'];
>>>   control.push(this.initAddress(''));
>>> }
>>>
>>> Please try like this,may this solve your problem
>>>
>>> Regards
>>> Amit
>>>
>>>
>>> On Thu, Oct 4, 2018 at 5:56 PM mahesh reddy <[email protected]>
>>> wrote:
>>>
>>>> Hi sir,
>>>>   If you don't mind may I know what you have done in your project
>>>> exactly
>>>>   In my project I want to create some items in each row and then again
>>>> when I click add function it should open the new row again in that new row
>>>> I want to add subitems.
>>>> So for each row it has some subitems.
>>>>  If you got what I am trying to say
>>>> Can you please share your code.
>>>>
>>>>
>>>>
>>>>
>>>> On Oct 4, 2018 5:51 PM, "Amit Shaw" <[email protected]> wrote:
>>>>
>>>>> Hi Mahesh,
>>>>>
>>>>> For this, you need to create an array for formGroup and while clicking
>>>>> on + you need to add a row in that array with blank values.
>>>>> If need code, let me know because I have done this in my project.
>>>>>
>>>>> Regards
>>>>> Amit
>>>>>
>>>>> On Thu, Oct 4, 2018 at 5:31 PM mahesh reddy <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> I want to add /remove  dynamically rows in modal popup after clicking
>>>>>> subitems in each row.I have been struggled to solve this issue.Could any
>>>>>> one help me???Thanks
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Angular and AngularJS discussion" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to [email protected].
>>>>>> To post to this group, send email to [email protected].
>>>>>> Visit this group at https://groups.google.com/group/angular.
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Angular and AngularJS discussion" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>> To post to this group, send email to [email protected].
>>>>> Visit this group at https://groups.google.com/group/angular.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Angular and AngularJS discussion" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To post to this group, send email to [email protected].
>>>> Visit this group at https://groups.google.com/group/angular.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Angular and AngularJS discussion" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at https://groups.google.com/group/angular.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to