Hi Sander,
Thanks for your reply. When you talk about dynamic template loading in our
case we are not doing exactly that but in few of our templates we are
dynamically injecting custom components like below marked in RED
<div class="col-md-6 col-xs-12">
<div class="form-group">
<label class="control-label">{{
ctrl.context.ElementName | translate }}: </label>
<span>{{
ctrl.context.StructureCodeAndDescription.Labels[ctrl.commoninfo.currentLanguage]}}</span>
</div>
<!--Repeats first column-->
* <line-element ng-repeat="elt in
ctrl.elements"*
element="elt.Name"
selectediteminlist="ctrl.selectediteminlist"
commoninfo="ctrl.commoninfo"
formeditline="ctrl.formeditline"></line-element>
</div>
Here above* line element i*s another component which has it's own
controller and service defined like below
*Component.js:*
'use strict';
var lineElement = {
bindings: {
commoninfo: '<',
element: '<',
selectediteminlist: '<',
formeditline: '<'
},
templateUrl: 'App/Components/EditLine/LineElement/lineElement.html',
controller: 'lineElementController',
controllerAs: 'ctrl'
};
*Controller:*
// Define dependency injection parameters
var injectParams = ['lineElementService', 'EHT_APPLICATION_CONSTANTS'];
// Create edit line details controller
var lineElementController = function (lineElementService, CONSTANTS) {
var ctrl = this;
// Change edit and view mode of FSG or Structure elements
ctrl.toggleEditMode = function () {
ctrl.element.EditLineEditModeEnabled =
!ctrl.element.EditLineEditModeEnabled;
if (ctrl.element.EditLineEditModeEnabled &&
!ctrl.element.PossibleFieldValues) {
// Invoke ConsultMDV service operation for error type
dropdownlist populate
lineElementService.getPossibleValues(ctrl.element,
ctrl.selectediteminlist);
lineElementService.updateFSGOrStructureElement(ctrl.element,
ctrl.selectediteminlist, false);
}
};
};
*Service:*
// Define dependency injection parameters
var injectParams = ['httpservice', 'EHT_APPLICATION_CONSTANTS',
'editLineService'];
// Create edit line details service
var lineElementService = function (httpservice, CONSTANTS,
editLineService) {
// Invoke possible values service call
var serviceOfPossibleValues = function (input) {
return httpservice.HttpPost(input,
CONSTANTS.API_ROUTES.GetDimensionValueForField);
};
// Get possible values on selection of edit link of FSG or
Structure tab
this.getPossibleValues = function (consultMDVReqVM,
selectedItemInList) {
var input = {};
input.FieldColumnName = consultMDVReqVM.FieldName;
input.Format = selectedItemInList.Format;
input.DocumentCEMIdentifierAsString =
selectedItemInList.DocumentCEMIdentifierAsString;
input.DocumentIdentifierAsString =
selectedItemInList.DocumentIdentifierAsString;
// Get service data from ConsultMDV service operation
serviceOfPossibleValues(input).then(function (response) {
if (response.data) {
consultMDVReqVM.PossibleFieldValues =
response.data.ConsultMDVValueList;
getDefalutValue(consultMDVReqVM);
}
}, function (error) {
});
};
This is in a nutshell how our current application code is structured. Hence
you can get an idea of what we need to migrate to Angular
On Saturday, February 17, 2018 at 11:26:19 AM UTC+5:30, Sander Elias wrote:
>
> Hi Ratno,
>
> Have a look at ngUpgrade <https://angular.io/guide/upgrade>. If you have
> correctly organized your code most of the logic/code inside your serves can
> remain untouched. I have found that I can port over all of the business
> logic without a hitch. Hooking it up to the backend/view changes a bit, but
> not in a dramatic way.
> The only real problem is when you do dynamic template loading/parsing.
>
> Regards
> Sander
>
--
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.