Commit 6dcf7631 authored by Evren Kutar's avatar Evren Kutar

handle empty model data

parent 4f82975e
...@@ -11,8 +11,9 @@ ...@@ -11,8 +11,9 @@
var staff = angular.module('zaerp.staff.add',['ngRoute','schemaForm', 'formService']); var staff = angular.module('zaerp.staff.add',['ngRoute','schemaForm', 'formService']);
/* StaffCtrl is a controller /**
which provide a form with form generator. * StaffCtrl is a controller
* which provide a form with form generator.
*/ */
staff.controller('StaffCtrl', function($scope, $http, $log, Generator, $routeParams){ staff.controller('StaffCtrl', function($scope, $http, $log, Generator, $routeParams){
......
...@@ -23,7 +23,7 @@ student.controller('StudentAddEditCtrl', function($scope, $http, $log, Generator ...@@ -23,7 +23,7 @@ student.controller('StudentAddEditCtrl', function($scope, $http, $log, Generator
$scope.schema = d.schema; $scope.schema = d.schema;
$scope.form = d.form; $scope.form = d.form;
// model is the init data of the form or in edit templates // model is the init data of the form or in edit templates
$scope.model = d.model; $scope.model = d.model ? d.model : {};
$scope.initialModel = angular.copy(d.model); $scope.initialModel = angular.copy(d.model);
// for email validation add asyncvalidator // for email validation add asyncvalidator
$scope.form[0].$asyncValidators = Generator.asyncValidators; $scope.form[0].$asyncValidators = Generator.asyncValidators;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment