ocTest.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. app.controller('DashCtrl', ["$rootScope", "$scope", function($rootScope, $scope) {
  2. console.log('ocLazy is load DashCtrl');
  3. console.log('aaaaaaaa');
  4. var vm = this;
  5. // funcation assignment
  6. vm.onSubmit = onSubmit;
  7. // variable assignment
  8. vm.issueNumber = ''; // <-- fill this in;
  9. vm.env = getEnv();
  10. vm.model = {};
  11. vm.options = { formState: {} };
  12. vm.fields = getFields();
  13. vm.originalFields = angular.copy(vm.fields);
  14. // vm.issueLink = 'https://github.com/formly-js/angular-formly/issues/' + vm.issueNumber;
  15. // function definition
  16. function getFields() {
  17. // return your fields here
  18. return [{
  19. key: 'firstInput',
  20. type: 'input',
  21. templateOptions: {
  22. label: 'Input',
  23. placeholder: 'Formly is terrific!'
  24. },
  25. expressionProperties: {
  26. 'templateOptions.label': 'model[options.key] || "Input"'
  27. }
  28. },
  29. {
  30. key: 'text',
  31. type: 'checkbox',
  32. templateOptions: {
  33. label: 'Hidden box'
  34. },
  35. hideExpression: '!model.firstInput'
  36. }
  37. ];
  38. }
  39. function onSubmit() {
  40. vm.options.updateInitialValue();
  41. alert(JSON.stringify(vm.model), null, 2);
  42. }
  43. function getEnv() {
  44. return {
  45. angularVersion: angular.version.full,
  46. // formlyVersion: formlyVersion
  47. };
  48. }
  49. }])