Billy Figueroa | 18 Apr 03:53 2014
Picon

view controller $scope.$on "watch" function not working...

Hi All,

so I have a quick issue with my controller ordering I guess.

I have the following shell page layout...

<html>
   <head></head>
   <body ng-controller="MainController">
      <div ng-view></div>
   </body>
</html>

I have an ng-view template that the routeProvider is loading (account.php) when we hit the url and load ClientController...

    .when('/client/:user_id/account', {
        templateUrl: '../MINT/views/account.php',
        controller: 'ClientController',
        restrict: true
    })


I also have an AuthFacotory factory where, once a user logs in and I get data back from my backend (PHP) I broadcast a signal to say we are authenticated

                    if (phpData.account_type === 'client')
                        $rootScope.$broadcast('clientAuthenticated', phpData);
                    else
                        $rootScope.$broadcast('providerAuthenticated', phpData);


I have the following I guess "watches" both inside the MainController and ClientController


<-- MainController -->
    $scope.$on('clientAuthenticated', function(phpData) {
        console.log("We caught the broadcast for clientAuthenticated[MainController]");
    });


<-- ClientController -->

    $scope.$on('clientAuthenticated', function(phpData) {
        console.log("We caught the broadcast for clientAuthenticated[ClientController]");
    });



I am only "catching" the one in the MainController.

Based on the structure being that the ClientController is loaded as part of the view, I m guessing its some sort of a child of the MainController but why is it not "catching" that broadcast?

the weird part is that I have other code in the ClientController and that gets executed but the console.log inside the scope statement is not

I wanted to create a jsfiddle or plunker but I rarely get them working when I try to do it in a non global modular way like real apps are written
i.e. var myApp = angular.module('myApp', [])

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
Rodrigo Mendonça | 18 Apr 00:01 2014
Picon

How can i insert slideUp and slideDown on angular way?

I am new in angular and i think slideUp and slideDown is a good way to deliver user experience. But in angular i am not finding any solutions to do that. Im my project i have angular and jquery. 
How can i mix slideUp e slideDown from jQuery on angular way, with reusable code?

Thanks

--
Rodrigo Mendonça

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
Neil Camara | 17 Apr 23:48 2014
Picon

scrolling many items in small box

Hi folks,

What the easiest way to implement a scrollable items from retrieved from a json? Please see attached image.

Thanks,

Neil 

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
David Gee | 17 Apr 22:03 2014
Picon

Unit testing a conditionally rendered isolate scope directive

I've been writing unit tests for angular controllers and services for a while now, but been putting off the daunting task of testing directives. 
I currently have an isolated scope directive, with an external controller that handles a flag which determines if the directive is rendered or not, via an ng-if on the directive's root element. The directive is for a "flash messages" style notifications system. I can't figure out how to set up the test correctly to default the flag to be true.

There's a simple jsFiddle here:
http://jsfiddle.net/BpG6Y/2/

Removing the "ng-if" from the directive template causes the test to pass. The test still fails if you change the template to use 'ng-if="true"'.

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
Sean Bollin | 17 Apr 20:03 2014

How to find which controller a specific data binding value is coming from

I have a data binding in the view {{ value }}

I want to find out what controller that $scope.value is being set in

How do I do this?

--

I tried clicking on the element in Chrome and following up the parent chain until I found the value (10 objects up) - not efficient
Even when I get to that object, is there a controllerName property somewhere?

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
Dude | 17 Apr 16:04 2014
Picon

angularJS parsing xml problem beanJSON

Hi All,

I have an xml file like this :

<Response>
  <Status>OK</Status>
  <Books>
    <Book>
      <id>1</id>
    </Book>
    <Book>
      <id>2</id>
    </Book>
  </Books>
</Response>

it is 
Content-Type:
application/xml;charset=UTF-8

when I call $http.get I get a strange object in return, for example if I want the first id I have to do :
data.Response.value.BooksBeanJSON.listBookBeanJSON[0].id
???
why .value. ? why xxxxBeanJSON ? and listXxxxBeanJSON ?

I which I had a String object so I could parse it myself but I don't have :(

Secondly when I put a copy of this xml on a file accessed throught my local apache (still
Content-Type:
application/xml;charset=UTF-8 )
I have a String result. Why is it different ?
Then if I parse it using x2js it's fine :
data.Response.Books.Book[0].id

can't find anything on the net, pls help

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
Deepak Patil | 17 Apr 14:38 2014
Picon

Re: Minify and injector

If you miss the array notation somewhere , to locate this we need to modify the angular code little bit, but its very quick solution.

change is console.log("Array Notation is Missing",fn); ( line no 11 from function start)

Find out annotate function in angular.js (non-minified)

  

    function annotate(fn) {
          var $inject,
              fnText,
              argDecl,
              last;
        
          if (typeof fn == 'function') {
            if (!($inject = fn.$inject)) {
              $inject = [];
              if (fn.length) {
    console.log("Array Notation is Missing",fn);
    fnText = fn.toString().replace(STRIP_COMMENTS, '');
            argDecl = fnText.match(FN_ARGS);
            forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg){
              arg.replace(FN_ARG, function(all, underscore, name){
                $inject.push(name);
              });
            });
          }
          fn.$inject = $inject;
        }
      } else if (isArray(fn)) {
        last = fn.length - 1;
        assertArgFn(fn[last], 'fn');
        $inject = fn.slice(0, last);
      } else {
        assertArgFn(fn, 'fn', true);
      }
      return $inject;
    }


On Monday, May 7, 2012 11:39:00 PM UTC+5:30, zhhz wrote:
Hello,

Not sure I'm doing it the angular way.

I am playing with the angular-phonecat app (https://github.com/angular/
angular-phonecat.git
), it works well until I minified the services.js.
I've added this line to the controller.js:

PhoneDetailCtrl.$inject = ['$scope', '$routeParams', 'Phone'];

Here is error info:

Error: Unknown provider: aProvider <- a <- Phone ("aProvider") <at> http://
localhost:8000/app/lib/angular/angular.js:2492
getService("aProvider") <at> http://localhost:8000/app/lib/angular/
angular.js:2620 ("a") <at> http://localhost:8000/app/lib/angular/angular.js:
2497 getService("a",[object Array]) <at> http://localhost:8000/app/lib/
angular/angular.js:2620


Anyone can help me out this? (I'm using closure compiler with the
simple optimize switch turned on)

Thanks.

--zhhz

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
Ziobudda | 17 Apr 02:57 2014
Picon

Call a function into a directive, passing parameters

Hi all, 

I have a custom directive. 

In my html i write this:

<uploader action="/rest/file/create_from_form.json" success="writeFid()"></uploader>

What I need is to exec "success" attribute function passing some parameter data that I get from my directive. I can exec "success" attribute function via

$scope.$eval($scope.success)

and in my "controller" I have this:

$scope.writeFid = function (data) {
        console.log("Into writeFid");
        console.log(data);  //this is my problem: it is always undefined.
}

I can see (via console.log() messages) that "success" function is called but without passing "data".

I have tried to use

<uploader action="/rest/file/create_from_form.json" success="writeFid(data)"></uploader>

but it does not work.

So: how can i pass some type of $scope.data ?

Thanks.

--
Davide Morelli




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

Ryan Zec | 17 Apr 01:03 2014
Picon

Separating functionality of a directive?

What is the best way to separate out different core pieces of functionality?

For example I have a extend component that has auto complete, tagging, and search query functionality.  I would like to separate those pieces of functionality into separate directives t make it easier to change or even replacing them if needed.  I remeber something being said about helper directive but never saw any actually implementations.

A more details question with a code example of my initial idea is here : http://stackoverflow.com/questions/23119168/how-to-separate-functionality-of-angular-directive

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscribe <at> googlegroups.com.
To post to this group, send email to angular <at> googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
Jacob Rief | 16 Apr 22:04 2014
Picon

Any news about ngAppRoute?

Today I came across issues #3102 , #2805 and #6129 which all are related to a problem I share with many others:

When html5mode=true, how can I internally link to resources on the local server without hacking with <base href="/path/to/self/">, (ab)using the "Otherwise"-Controller, adding target="_self" or prefixing internal links with its full server name.

In #3102 there was rumor about a new directive named "ngAppRoute" which could solve these problems. But unfortunately I can't find any code containing this directive.

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

http://new.cjsh.name working?

As posted in http://stackoverflow.com/questions/23117337/why-is-this-angualrjs-data-binding-not-working , I have an attempt at including unescaped HTML in a modification of step 3 of the AngularJS tutorial, at http://new.cjsh.name.

​I seem to have broken it.

What can I do to get name and snippet to display like the example in step​
​ 3 of the tutorial, displaying book.title and book.snippet, but not escaping HTML tags in the book.snippet?

​(I am willing to go along either with the sanatizer, or something that just trusts the HTML as it is given.)​


​Thanks,​


--
Christos Jonathan Seth Hayward, an Orthodox Christian author.

Amazon / Kindle • Author • Author Bio • Email • Facebook • Fan Page • Google Plus • LinkedIn • Professional • Twitter • Web • What's New?

If you read just one of my books, you'll want The Best of Jonathan's Corner.

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

Gmane