sábado, 29 de septiembre de 2018

post JSON.stringify ANGULAR 6

https://grokonez.com/frontend/angular/angular-6/angular-6-httpclient-get-post-put-delete-requests-springboot-restapis-bootstrap-4


import { HttpClient, HttpHeaders } from '@angular/common/http';




const httpOptions = {
  headers: new HttpHeaders({ 'Content-Type': 'application/json' })
};



restItemsServiceGuardarEsal() { return this.http .post(this.guardarEsalURL,JSON.stringify({"email":"sidsfidf@gmail.com","id":100,"nombre":"adsfasdfasdf ","sitioWeb":"dsafsdf"}) , this.httpOptions) .pipe(map(data => data)); }


guardarEsal() {
  this.restItemsServiceGuardarEsal()
      .subscribe(
        esalGuardar => {
          this.esalGuardar = esalGuardar;
          console.log(this.esalGuardar);
        }
      ) 
  }

'Access-Control-Allow-Headers': 'Content-Type' json


  
    <add name="Access-Control-Allow-Origin" value="*" />
    <add name="Access-Control-Allow-Headers" value="Origin, X-Requested-With, Content-Type, Accept" />
  </customHeaders>
</httpProtocol>

As hinted at by this post Error in chrome: Content-Type is not allowed by Access-Control-Allow-Headers just add the additional header to your web.config like so..

Method DELETE is not allowed by Access-Control-Allow-Methods in preflight response.

https://stackoverflow.com/questions/36374247/always-got-method-delete-is-not-allowed-by-access-control-allow-methods-in-prefl

componentes input angular 6

https://blog.ng-classroom.com/blog/angular/compartiendo-info-componentes/

Module not found: Error: Can't resolve 'rxjs/add/observable/fromEvent'

https://stackoverflow.com/questions/48280400/cant-resolve-rxjs 

push-notification delete virus

https://malwaretips.com/blogs/remove-push-news-systems/#uninstall

viernes, 28 de septiembre de 2018

VARIABLE EN ANGULAR 6

nombreUsuario: string = '';

NOT ENFORCE HTTP FACEBOOK

https://success.tanaza.com/s/article/The-Enforce-HTTPS-setting-on-Facebook-apps-prevents-them-from-working-correctly-on-splash-pages-belonged-to-White-Label-accounts

google sign in

https://developers.google.com/identity/sign-in/web/server-side-flow

angular social login

https://www.npmjs.com/package/angular-6-social-login

cookies angular 6

https://stackoverflow.com/questions/50772529/how-to-create-cookies-in-angular-6

jueves, 27 de septiembre de 2018

Provided host donacolombia.com could NOT be bound. Please provide a different host address or hostname Error: Provided host donacolombia.com could NOT be bound. Please provide a different host address or hostname


https://stackoverflow.com/questions/50519121/angular-6-how-to-change-default-port-4200down vote
As far as I can tell the behavior is correct. A basic node web server uses dns.js to resolve any hostname – which itself uses the system's DNS resolution method.
A hostname "127.0.0.1" as well as "localhost" can't be resolved by OS X's mDNS responder (neither non-reverse nor reverse).
So either use your Mac's IP (i.e. 192.168.0.13) or its hostname (e.g. tims-macbook-pro) as hostname. To advertise the service in Bonjour you have to use dns-sd.

"host": 0.0.0.0 serve node.js angular.js


The .angular-cli.json file allows you to specify Angular-CLI configuration options; including the default hostname and port.
serve: Properties to be passed to the serve command
   port (number): The port the application will be served on. Default is 4200.
   host (string): The host the application will be served on. Default is localhost.
You can define the used port in the .angular-cli.json file by defining the property like this:
{
    "defaults": {
        "serve": {
            "port": 2500
        }
    }
}

See the Angular CLI documentation for more info and a complete listing of configuration options:https://github.com/angular/angular-cli/wiki/angular-cli

Command line solution
If you're looking for a command line solution that does not require and configuration editing, simply run the ng serve or ng serve --prod commands with the optional host and port commands.
ng serve --host 0.0.0.0 --port 4201
Using these optional command line parameters, you can simply run the command twice, each with different a host and port.

Side note: That being said, unless you are going to be serving your Angular application using the Angular CLI, you'll likely need to configure these options using the methods associated with your hosting platform.

ng serve --host 0.0.0.0 --disable-host-check

ng serve --host 0.0.0.0 --disable-host-check

cors FILTER in java 7

https://howtodoinjava.com/servlets/java-cors-filter-example/

create the class:

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
/**
 * Servlet Filter implementation class CORSFilter
 */
// Enable it for Servlet 3.x implementations
/* @ WebFilter(asyncSupported = true, urlPatterns = { "/*" }) */
public class CORSFilter implements Filter {
 
    /**
     * Default constructor.
     */
    public CORSFilter() {
        // TODO Auto-generated constructor stub
    }
 
    /**
     * @see Filter#destroy()
     */
    public void destroy() {
        // TODO Auto-generated method stub
    }
 
    /**
     * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain)
     */
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain)
            throws IOException, ServletException {
 
        HttpServletRequest request = (HttpServletRequest) servletRequest;
        System.out.println("CORSFilter HTTP Request: " + request.getMethod());
 
        // Authorize (allow) all domains to consume the content
        ((HttpServletResponse) servletResponse).addHeader("Access-Control-Allow-Origin""*");
        ((HttpServletResponse) servletResponse).addHeader("Access-Control-Allow-Methods","GET, OPTIONS, HEAD, PUT, POST");
 
        HttpServletResponse resp = (HttpServletResponse) servletResponse;
 
        // For HTTP OPTIONS verb/method reply with ACCEPTED status code -- per CORS handshake
        if (request.getMethod().equals("OPTIONS")) {
            resp.setStatus(HttpServletResponse.SC_ACCEPTED);
            return;
        }
 
        // pass the request along the filter chain
        chain.doFilter(request, servletResponse);
    }
 
    /**
     * @see Filter#init(FilterConfig)
     */
    public void init(FilterConfig fConfig) throws ServletException {
        // TODO Auto-generated method stub
    }
 
}


add im web.xml


Now register this filter in web.xml.
<filter>
    <filter-name>CorsFilter</filter-name>
    <filter-class>com.howtodoinjava.examples.cors.CORSFilter</filter-class>
</filter>
 
<filter-mapping>
    <filter-name>CorsFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>