Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- App.controller('CompaniesController', [CompaniesController]);
- function CompaniesController($scope, $http) {
- var vm = this;
- vm.controls = {
- form: {
- show: false
- , button_label: 'Cadastrar'
- , button_status: true
- , submiting: false
- }
- };
- vm.form = {
- type_inscription: ''
- , inscription: ''
- , name: ''
- , nick_name: ''
- , country: ''
- , state: ''
- , city: ''
- , zipcode: ''
- , address: ''
- , number: ''
- , district: ''
- , addition_address: ''
- , username: ''
- , email: ''
- , password: ''
- , password_confirm: ''
- , language: ''
- , timezone: ''
- };
- vm.controlsFormShow = controlsFormShow;
- function controlsFormShow() {
- vm.controls.form.show = !vm.controls.form.show;
- }
- refresh();
- getCountries();
- vm.refresh = refresh;
- function refresh() {
- }
- vm.add = add;
- function add() {
- console.log('entrou');
- vm.companies.push({name: 'Márcio Dias', email: 'sgeo@sgeo.com.br'});
- }
- vm.remove = remove;
- function remove(companies) {
- }
- vm.edit = edit;
- function edit(company, index) {
- vm.controls.form.button = 'Salvar';
- }
- vm.save = save;
- function save(company) {
- }
- vm.getCountries = getCountries;
- function getCountries() {
- $http({
- method : 'GET',
- url : '/api/public/countries',
- headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
- })
- .success(function(data) {
- if(data.success == true) {
- vm.countries = data.countries;
- }
- });
- }
- vm.getStates = getStates;
- function getStates(value) {
- if(value !== undefined) {
- $http({
- method : 'POST',
- url : '/api/public/states',
- data : { id_country: value },
- headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
- })
- .success(function(data) {
- if(data.success == true) {
- vm.states = data.states;
- }
- });
- }
- }
- vm.getCities = getCities;
- function getCities(value) {
- if(value !== undefined) {
- $http({
- method : 'POST',
- url : '/api/public/cities',
- data : { id_state: value },
- headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
- })
- .success(function(data) {
- if(data.success == true) {
- vm.cities = data.cities;
- }
- });
- }
- }
- }
- CompaniesController['$inject'] = ['$scope'];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement