Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 08:54
    gkalpak milestoned #46057
  • 08:54
    gkalpak demilestoned #46057
  • 08:54
    ngbot[bot] milestoned #46057
  • 08:54
    ngbot[bot] milestoned #46057
  • 08:54
    ngbot[bot] milestoned #46057
  • 08:54
    ngbot[bot] milestoned #46057
  • 08:54
    gkalpak labeled #46057
  • 08:54
    gkalpak labeled #46057
  • 08:54
    gkalpak labeled #46057
  • 08:54
    gkalpak labeled #46057
  • 08:54
    gkalpak labeled #46057
  • 08:54
    gkalpak labeled #46057
  • 08:54
    gkalpak review_requested #46057
  • 08:54
    gkalpak opened #46057
  • 08:53
    gkalpak demilestoned #46056
  • 08:53
    gkalpak milestoned #46056
  • 08:52
    ngbot[bot] milestoned #46056
  • 08:52
    gkalpak labeled #46056
  • 08:52
    gkalpak labeled #46056
  • 08:52
    gkalpak labeled #46056
Hussain
@hussainb
no not config
Take an example, I need to show plain alerts, but need to change the text between diffenernt components
Rob Wormald
@robwormald
[bindings] are fine then
Hussain
@hussainb
So, I pass a callback having the alert its own text and fire the callback when an input on the nav component is clicked
yes
Rob Wormald
@robwormald
yeah, that would be better served with (click)
Hussain
@hussainb
yep
Rob Wormald
@robwormald
not [somefuncitontobecalled]
Hussain
@hussainb
Oh ok
Rob Wormald
@robwormald
properties go in with [bindings]
events come out with (eventName)
Hussain
@hussainb
ok
Rob Wormald
@robwormald
also, for stuff like an alert, you're better to use a service to control it
Hussain
@hussainb
oh, true
Zahadi Eslicho
@panKt

Let’s say I'll put some data into route that will show that this route needs auth.
Is there some global way to intercept navigation to that route and
1) Find out if that route needs an auth
2) Redirect to login page if there is no auth
3) Of course component that represents that route should not be created if there is no auth
3) View should not be rendered if there is no auth

@CanActivate can do similar thing, but it needs to be added on components. I'm looking for a way to avoid that copy-paste on every component

Hussain
@hussainb
I will look into using a service instead.
Anthony
@qdouble
@robwormald thanks, ['whatever'] does the job just fine
Rob Wormald
@robwormald
Hussain
@hussainb
@robwormald , OK, looking at it
Oh, this is the alert service!
Rob Wormald
@robwormald
so the service is injected into the component, and then you can also inject it into any other component or service
Hussain
@hussainb
Yes!
@robwormald, ThankYou!
Anthony
@qdouble

@robwormald one last bit of functionality, there's also this command

grecaptcha.reset(
opt_widget_id
)

Just in case you need to reset captcha, for instance if the person has completed the captcha but still entered in the wrong password. So I'm assuming you'd need to pass that command from the component into the directive? How would do we go about that?

Rob Wormald
@robwormald
in reality i'd probably wrap up most of the captcha stuff into an injectable service
and inject that into your captcha component
Anthony
@qdouble
the service would be shared between the component and the directive?
Rob Wormald
@robwormald
right. it would allow you to "remote control" the captcha
like the alert service plunk above ^
Anthony
@qdouble
gotcha, will look into that now
Hussain
@hussainb
@robwormald deserves an xmas present
Oleg Korsak
@kamikaze
is there a way to prevent following code to make a request while previous is not completed (except manuall semaphore mess)? Not only prevent it but also all parallel callers must receive the same observer. Tried to use ReplaySubject and .share() with no luck. Any ideas?
signin(login:string, password:string):Observable {
    var data = {
      login: login,
      password: password
    };

    return this.http.put('/api/v1/auth', JSON.stringify(data))
      .map(res => res.json());
  }
Rob Wormald
@robwormald
@kamikaze that's sort of the wrong way to think about it. the first question would be - why is it making multiple requests? are you queuing them up or?
presumably you're getting a token or something for further requests?
Oleg Korsak
@kamikaze
@robwormald it may be long request-response while user clicks "signin" button again and again
it's not a way to think, it's a reality :)
Rob Wormald
@robwormald
well the first thing i'd do would be disable the damn button :)
Oleg Korsak
@kamikaze
sure but I just want to make sure that this request is kinda "singleton"
Rob Wormald
@robwormald
that's why i was asking about how you're structuring this - presumably you're going to:
  • naviate to a login page
  • click signin
  • wait for response
  • naviate to page
  • use token from login request?
Anthony
@qdouble
@robwormald I'm messing around with the shared service stuff now, and sharing values seems very easy and straightforward enough... is there also a straightforward way to use a service to call a function in another component/directive, or would I have to move those functions into the service?
Andy Brown
@brownish
Is it possible to inject an angular 1.x component into a bootstrapped angular2 app? Sort of a reversed "Upgrading from 1.x" docs scenario. I'd love to rebuild my app as angular2 while still including a couple angular 1.x components that have dependencies not yet compatible with 2.x.
Night Monkey
@NightAOtidae
+1 @brownish
+1 @brownish I would like to see how to do it both ways
Daniel
@gaiottino
@robwormald thanks for your answer on angular/angular#6152. Unf. it seems plnkr is down but I can read the docs.
Andy Brown
@brownish
@NightAOtidae yeah I'm testing out different ways of doing it using https://github.com/AngularClass/angular2-webpack-starter, following the docs. The components I was to use with angular2 follow https://github.com/AngularClass/NG6-starter so i would think it should be possible.