[AngularJS] Wait for http.post to return Cookie.set

2017-07-11 Thread Zlatko Đurić
Well it's not"after the map" that's the problem here, it's"after the map has 
resolved".

So in your use case when you need to call getRefresh, you would have to chain 
the two calls; first, call the refresh token endpoint, and when it comes back, 
than you can use your cookie.
So your "resource" call would make two chained calls and return the result of 
the second call. You can do that by returning a flatMap instead of map. But 
that would do just for the branch with no cookie set in advance.
Now to streamline it, maybe _always_return a flatMap and get the cookie in s 
separate private method that returns the cookie if there, or fetches it if not. 
And the return is always an observable you can subscribe to.

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.


[AngularJS] Re: WebComponent in Angular

2017-07-11 Thread Sander Elias
Hi Nitin,

Well, it probably won't make it into version 5, but this is something 
that's being explored. There are already working prototype custom elements 
that were built with angular. I'm not too sure on the by default part of it.

The current issue with custom elements is that it is not browser agnostic. 
You still need polyfills, and the available polyfills do not adhere 100% to 
the standard. I have seen projects running into trouble with it. 
Also, this applies to polymer. The resulting components don't really 
integrate that well with other frameworks. Those are growing pains, in both 
accounts. 

Also, components are really nice, and I use them a lot. But remember this. 
Here is a pile of components:
[image: Afbeeldingsresultaat voor pile of lego bricks]
see all those nice components.
but to turn it into something like this:
[image: Afbeeldingsresultaat voor lego large construction]

You really need something more as just the components.
That's why I like angular. It doesn't only provide a way to create 
components, it also make sure your build runs smoother. It hands you 
architectural tools alongside the components.

Regards
Sander

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.


[AngularJS] WebComponent in Angular

2017-07-11 Thread Nitin Jain
Hello,

I am starting a new project and evaluating Angular as one of the framework 
for frontend. I found there is a shift in design approaches where we are 
now moving from MVC world to Component oriented ecosystem. The same design 
can be found in latest Angular version as well. 

Angular support component oriented development design but somehow it 
doesn't inherit web-component standards which truly makes your components 
framework and browser agnostic.

My Question is in coming releases *are we planning to have web-component 
based standards by-default in Angular *or we should go by other route by 
creating Polymer components (based on web-components standards) and then 
glue them in Angular.

Thanks 
Nitin Jain

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.


[AngularJS] Access Sharepoint 2016 REST API Data from Cordova Angular Application

2017-07-11 Thread Pardhu G


Hi All,


I want to get/post data from SharePoint REST API to the angular 
application. The Cordova angular application needs to support both iOS and 
Android platforms.


In iOS native platform I am able to connect to SharePoint services using 
the below process.

   1. Open SharePoint site URL in the browser view, the user will 
authenticate using credentials and get Fedauth and rtfa tokens.

  2. In SharePoint get request pass these tokens in header.


Please guide me on In angularjs how to authenticate and get/post data using 
share point REST API.


Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.


[AngularJS] Access Sharepoint 2016 REST API Data from Cordova Angular Application

2017-07-11 Thread Pardhu G


Hi All,


I want to get/post data from SharePoint REST API to the angular 
application. The Cordova angular application needs to support both iOS and 
Android platforms.


Please guide me on how to authenticate and get/post data using share point 
REST API.


Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.


[AngularJS] Re: Angular 2 and MongoDB, How can I use it?

2017-07-11 Thread Tito
here is a very simple app I wrote that uses MongoDb with express.js in the 
middle

https://github.com/yosiasz/d3-node-express-mongodb

On Thursday, July 6, 2017 at 1:47:02 PM UTC-7, Sykes Creatives wrote:
>
> I want to implement a NoSQL type database for my web apps. I was using 
> Firebase but im not a fan of the restrictions and cant really afford the 
> premium version of it at the moment, so MongoDB was my next coice. Seeing 
> that MongoDB is based on NodeSQL is it possible to have a db hosted along 
> side my app? How would I go about implementing that?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.


Re: [AngularJS] Re: Looking for a HTML layout tool

2017-07-11 Thread Reza Razavipour
Sorry about that folks, I just found what I was looking for.

Thank you all.

Regards,
Reza

On Tue, Jul 11, 2017 at 7:17 AM, Reza Razavipour 
wrote:

> not seeing if the flex-layout works with SystemJS. Can anyone tell if it
> does?
>
> Regards,
> Reza
>
> On Mon, Jul 10, 2017 at 9:53 PM, Sander Elias 
> wrote:
>
>> Hi Reza,
>>
>> html/css will work fine. You might want to use the Angular Flex-layout
>> 
>>
>> Regards
>> Sander
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Angular and AngularJS discussion" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>> pic/angular/rHfC-r_yByc/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> angular+unsubscr...@googlegroups.com.
>> To post to this group, send email to angular@googlegroups.com.
>> Visit this group at https://groups.google.com/group/angular.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.


Re: [AngularJS] Re: Looking for a HTML layout tool

2017-07-11 Thread Reza Razavipour
not seeing if the flex-layout works with SystemJS. Can anyone tell if it
does?

Regards,
Reza

On Mon, Jul 10, 2017 at 9:53 PM, Sander Elias  wrote:

> Hi Reza,
>
> html/css will work fine. You might want to use the Angular Flex-layout
> 
>
> Regards
> Sander
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Angular and AngularJS discussion" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/angular/rHfC-r_yByc/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> angular+unsubscr...@googlegroups.com.
> To post to this group, send email to angular@googlegroups.com.
> Visit this group at https://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.


[AngularJS] Re: Angular 4 guide PDF

2017-07-11 Thread Sander Elias
Hi Yash,

I just love boolean questions ☺
No, there is none. I can add to that that there probably will never be an 
official one. 
However, if it is so you can put it on a device, for easy access, on most 
tablets and phones the entire guide will work offline. It will keep the 
pages you have visited in its cache. The whole documentation site is an 
Angular PWA application.

Regards
Sander

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.


[AngularJS] Wait for http.post to return Cookie.set

2017-07-11 Thread Tommaso Betti
Hi everyone. I'm trying to giving synchronous behavior to my authentication 
workflow in angular 2 but i can't resolve.

Here's the code:

saveToken(token){
  debugger;
  var expireDate = 0.0003472;
  //var expireDate = token.expires_in;

  Cookie.set("access_token", token.access_token, expireDate);
  Cookie.set("refresh_token", token.refresh_token, 1);

  console.log("saveToken -> il token passato come param scade in secondi: " + 
token.expires_in);

  //controlli sui cookie contenitori dei due token
  if(Cookie.check("access_token"))
console.log(Cookie.get("access_token"));
  if(Cookie.check("refresh_token"))
console.log(Cookie.get("refresh_token"));

  this._router.navigate(['/']);
}

getRefresh(token):Observable{
  debugger;
  console.log("sono dentro get refresh");
  console.log(token);
  let params = new URLSearchParams();
  params.append('grant_type','refresh_token');
  params.append('refresh_token',token);
  params.append('client_id','web_app');

  let headers = new Headers({'Content-type': 
'application/x-www-form-urlencoded; charset=utf-8','Authorization': 'Basic 
'+btoa("web_app:")});
  let options = new RequestOptions({headers: headers});

  return 
this._http.post('http://localhost:9997/oauth/token',params.toString(),options)
.map(res => res.json());
}

getResource(resourceUrl): Observable {
  debugger;
  var cookie;

  var bool = (!(Cookie.get("access_token")));
  console.log("step in GET RESOURCE");
  console.log("access token e' assente? : "+bool);

  if (!Cookie.get("access_token")) { //controllo sei il token e' sempre vivo
this.getRefresh(Cookie.get("refresh_token"))
  .subscribe(
data => this.saveToken(data),
err => alert('Invalid Credentials')
  );

cookie = Cookie.get("access_token");

  } else {
cookie = Cookie.get("access_token");
  }

var headers = new Headers({
  'Content-type': 'application/x-www-form-urlencoded; charset=utf-8',
  'Authorization': 'Bearer ' +  cookie 
//Cookie.get('access_token')
});
//a questo punto gli headers sono pronti e il token e' stato assegnato
var options = new RequestOptions({headers: headers});

return this._http.get(resourceUrl, options)
  .map((res: Response) => res.text())
  .catch((error: any) => Observable.throw(error().json().error || 'Server 
error'));

}


As you can see, everything starts from getResource that is called from the 
component like this

export class FooComponent {
//public foo = new Foo(1,'sample foo');
private stringret : string;
public errorMessage : string; 
private id : number = 0; 

private foosUrl = 'http://localhost:/foo';

constructor(private _service:AppService) {}

getFoo(){
this._service.getResource(this.foosUrl)
 .subscribe(
 data => (this.stringret = data) && this.id++,
 error =>  this.errorMessage = "Errore!");
}
}


As i run the console on chrome, i can see immediatly the problem : 
->When i call the getRefresh function and then subscribe to it, the data => 
this.saveToken(data), isn't resolved
Nothing change if i put the subscribe after the map in getRefresh-> cookie 
still get null as value.
Due to asynchronous workflow i think.

How i can solve? thanks in advance

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.


[AngularJS] Angular 4 guide PDF

2017-07-11 Thread Yash Ganthe
Hi,

The guide for Angular 4 is available online at 
https://angular.io/guide/quickstart. Is there a PDF version of this guide?

Regards,
Yash

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.


[AngularJS] Re: Is there a way to use svg iframe in angular4

2017-07-11 Thread Sander Elias
Hmm, That's an entirely different question.
As long as it's in the same origin, you can do something like:



In your component, grab the myFrame by using viewChild, and then:

if (myFrame.nativeElement) {
   //shielded for non-browser enviroments
   const iframe = myFrame.nativeElement
   const iframeDocument = iframe.contentDocument;
   // go ahead here
}

this works for normal iframes, I never tried it with svg though.

Regards
Sander

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.


[AngularJS] Re: Is there a way to use svg iframe in angular4

2017-07-11 Thread Stéphane Ancelot
I may have badly formatted my question .

I want to acces an svg file embedded in a regular iframe  (classic !) 



Le lundi 10 juillet 2017 14:59:43 UTC+2, Stéphane Ancelot a écrit :
>
> Hi,
> I was wondering which is the right way to embed an svg iframe file in 
> order to manipulate it's dom ?
>
> Regards,
> Steph
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.