In a large codebase, there is a straightforward scenario that I need help with:
- There is an Angular APP and Controller already set up and functioning correctly.
- However, a
ng-model
element needs to be dynamically created at a later stage (perhaps through an ajax call). How can I bind this element to the existing controller?
Here's an example to better illustrate the issue:
var dtApp = angular.module('App1', []);
dtApp.controller('Cont1', function($scope)
{
.
.
.
.
$scope.xyz='1';
}
.
.
.
//element created dynamically on click:
<input type="text" ng-model="xyz" />
.
Although this example is simple, finding a solution will greatly benefit me in solving a much larger problem.
I appreciate any assistance you can provide. Thank you!