try
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
var app = angular.module('myModule', []);
app.controller('myController', function ($scope, $compile) {
$scope.myfunction = function () {
var dyn = angular.element(document.getElementById("test"));
$compile(dyn)($scope);
}
});
$(document).ready(function () {
for (i = 0; i <= 4; i++) {
var _input = document.createElement("input");
_input.setAttribute("type", "number");
_input.setAttribute("ng-model", "quantity" + i);
var _result = document.createElement("p");
_result.setAttribute("ng-bind", "quantity" + i);
document.getElementById("test").appendChild(_input);
document.getElementById("test").appendChild(_result);
}
angular.element(document.getElementById('test')).scope().myfunction()
});
</script>
</head>
<body >
<div id="test" ng-app="myModule" ng-controller="myController">
</div>
</body>
</html>