I am using metronic with angular and I have the controller all right, however I tried to create a function that displays what the user typed in a field in an alert (in the future I will filter) ...
HTML file:
angular.module('App').controller('UserProfileController', function($rootScope, $scope, $http, $timeout) {
$scope.$on('$viewContentLoaded', function() {
App.initAjax(); // initialize core components
Layout.setSidebarMenuActiveLink('set', $('#sidebar_menu_link_profile')); // set profile link active in sidebar menu
$scope.form.txt;
});
// set sidebar closed and body solid layout mode
$rootScope.settings.layout.pageBodySolid = true;
$rootScope.settings.layout.pageSidebarClosed = true;
$scope.Submit = function() {
alert($scope.form.txt);
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.min.js"></script><formrole="form" action="#" ng-submit="Submit()">
<div class="form-group">
<label class="control-label">First Name</label>
<input type="text" ng-model="form.txt" placeholder="John" class="form-control" /> </div>
<div class="margiv-top-10">
<a input type="submit" id="submit" ngClick="Submit()" class="btn green-haze"> Save Changes </a>
</div>
</form>
Does anyone know how to fix it? Obg