Skip to content

Instantly share code, notes, and snippets.

View thiagosbrito's full-sized avatar
🕺
Baila y Baila

Thiago Brito thiagosbrito

🕺
Baila y Baila
View GitHub Profile
var httpRequest;
var makeHTTPRequest = function (url) { // se vc quiser tirar o parametro url, vc precisa passar a url na linha 22
if (window.XMLHttpRequest) {
httpRequest = new XMLHttpRequest();
} else if (window.ActiveXObject) { // quando nao for Chrome ou Safari
try {
httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
try {
[
{"name": "Afghanistan", "code": "AF"},
{"name": "Åland Islands", "code": "AX"},
{"name": "Albania", "code": "AL"},
{"name": "Algeria", "code": "DZ"},
{"name": "American Samoa", "code": "AS"},
{"name": "AndorrA", "code": "AD"},
{"name": "Angola", "code": "AO"},
{"name": "Anguilla", "code": "AI"},
{"name": "Antarctica", "code": "AQ"},
{
"swagger": "2.0",
"info": {
"description": "Api Documentation",
"version": "1.0",
"title": "Api Documentation",
"termsOfService": "urn:tos",
"contact": {},
"license": {
"name": "Apache 2.0",
@thiagosbrito
thiagosbrito / interceptor.js
Last active October 6, 2015 14:38
LoginController.js
angular.module("emailOverviewApp").factory('requestInterceptor', [
'$rootScope', '$q', '$log', function($rootScope, $q, $log) {
var checkSession, noCache, setRequestHeader;
noCache = function(url) {
return url + "?_=" + (Math.random());
};
checkSession = function(request) {
if (request.status === 401) {
// Feedback.fail("Não autenticado");
$rootScope.$emit("loginRequired");
// acao que deveria inserir o pedaco do dom no form
$scope.newField = (element) ->
element = $('#newFundamentalCause').children()
$scope.formCausa.push(element)
// botao que adiciona o campo chamando a funcao newField()
<button type="button" class="btn btn-primary pull-right" ng-click="newField()"><i class="fa fa-file"></i> {{'actions.NOVO' | translate}} </button>