Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Jared
@jareddr
and then you’ll send a map id intot your map directive
sorry i feel like i’m not being super helpful, i can’t totally see what your code is trying to do
Darrin Dickey
@darrindickey
In the directive, there is data that includes placeId (unique to each location).
I loaded that into the locationsId variable. And I'm trying to pass it to the controller.
I was using the scope changed: '=' to do two-way binding on the data.
Jared
@jareddr
then i think your html should look more like this
Darrin Dickey
@darrindickey
Was passing through the directive element in the view via changed='updateMap(locationId)'
Jared
@jareddr
<map-list changed=‘locationId’></map-list>
Darrin Dickey
@darrindickey
But that won't call the updateMap function in the controller.
Sorry, I think I'm being confusing. Let me try what you suggest and see what I get.
Jared
@jareddr
correct, so you want something in the directive to call a function in the controller i see
so yeah in your controller define an update map function
this goes in your controller: scope.updateMap = function(locationId) { console.log(locationId) }
then in your html do
<map-list updateMapFunction=‘updateMap’></maplist>
then in your directive you would do
scope: { updateMapFunction = ‘&’ }
then somewhere in your directive you’ll have to call that function you pass in
a button in your maplist could have <button ng-click=“updateMapFunction(1)”>
i haven’t tested that, so i’m not sure if it works, but its in the right direction
Darrin Dickey
@darrindickey
I'll give it a shot. Thanks!
Darrin Dickey
@darrindickey
Tried it, but it still doesn't pass locationId out of the directive.
Jared
@jareddr
your goal should be first just to get that updateMap function in the controller being called
if you can get it called in any form, passing the locationId should be easy
a plunkr is worth a thousand chats
Darrin Dickey
@darrindickey
I'll look at the Plunkr now. I can call the controller function on click. I just can't pass the value from the directive.
Jared
@jareddr
i see
Jared
@jareddr
interesting, yeah I’m stumped when i try to call a function from the parent controller with a parameter. You can change the value directly in the controller with a two-way binding variable, but i’m not sure how to do that with a function
Darrin Dickey
@darrindickey
Is it possible to pass a value from one directive to another?
geoguide
@geoguide
I have a beginner question. If someone logs in I want to show a logout button (or the navigation in general). I figured I’d just change an app variable and then do an ng-show={{loggedIn}} and so I set app.value(‘loggedIn’,true); but it’s not working. What’s the right way to do this? Do have to make a MenuCtrl and then set something in that controller from LoginCtrl? Or do I need to make an AuthenticatedAreaCtrl to wrap around everything? I’m getting kind of lost.
Nelo Mitranim
@Mitranim
@geoguide The typical solution is to have an authentication service that would encapsulate this information
module.value creates a constant, more or less. You don't want to use this for dynamic information
Srinivasan
@kksrini89
I have been doing with ngRoute. I've SPA which having 2 tabs clicking on each tab we show partial as html, but I'm experiencing issue while navigating from one tab to another tab when use like below.
angular.module('sam',['ngRoute']).config(function($routeProvider){ $routeProvider.when('/main/customer',{ templateUrl:"customer.html", controller:"customerController" }) .when('/main/client',{ templateUrl:"client.html", controller:"clientController" }); });
the above line kept it as separate file called app.js, Here I use ASP.NET MVC as backend, so from index.cshtml I did like below
<a href="/main/customer">Customer</a> <a href="/main/client">Client</a>
I am experiencing an issue with above coding. But in angular ngRoute the second / looks for routeParams???that's why I'm getting error??
Can anyone help me in this.
Nelo Mitranim
@Mitranim
@kksrini89 suggest using markdown formatting to make your code more readable. Surround code blocks with triple backticks
Could you please clarify the routeparams issue? It's unclear what your problem is
camspilly
@camspilly

Hi I'm trying to make a pane system in which elem.bind('change,...) on a child directive changes the "selected" parent directive: http://plnkr.co/edit/gc35fuUiJVUhHF4QMAwv?p=preview

(When you pick gender (either male or female), I want it to go to the next pane in succession, but I assume due to scope issues (i'm fairly rusty with angular), that it never gets into the linked attribute of the child directive.
Any ideas?

camspilly
@camspilly
anybody?
js
@js08
is there any angular js certification
camspilly
@camspilly
no
js
@js08
do u guys know any js framework which does px testing for entire web app, any automated js framework
Brad Wertman
@bmwertman

I've added a button to my modal with var myBtn = document.createElement('button').

The modal operates under controller 'ChildController'.

I want the button to call a function in 'ParentController'.

I tried to do myBtn.setAttribute('ng-controller', 'ParentController') with no luck.

Is there a better way I could go about this?

camspilly
@camspilly
#11793
Antonio Mello
@acmello
Hi you guys
how are you?
So, today I was messing around with angular and speech recognition API and had this idea to put this all together
so I've created a reusable directive which implements webkit speech recognition API to be used along with html forms
it's pretty sketchy but you guys can take a look at https://github.com/acmello/angular-speech-recognition
feel free to try it out and give me any feedbacks
thanks