Darn it, I don't like how the "versioning" on this works. Its quirky or I 
don't understand it. I changed this. I removed the CSS and added ng-show to 
both of the input blocks with booleans "typeChosen" and "dateChosen" which 
are set to true in the directive when a change event occurs.

Please do me a favor and check if the plunker has updated now?

I will look into re-writing the way I am doing this in terms of the data as 
you suggested, thanks for the advice as far as doing things the right way 
in the long term. 

On Wednesday, May 7, 2014 2:19:23 AM UTC-4, Sander Elias wrote:
>
> Billy,
>
> The plunk you just linked in, still has the css to hide the stuff, and it 
> works as you remove the css.
> You should not load data into scope in a directive, I might seem a good 
> idea to you now, but trust me on this, it really isn’t. This should be done 
> in a controller.
> If the data is really local to the directive, add a controller to the 
> directive.
> The service you are using to load the data, can also ‘preload’ the data 
> into the same factory, so it’s available without refetching it every time 
> you need it.
> something like:
>
>    .factory("DropdownFactory", ["$http",
>       function($http) {
>          factory = {
>             times: {},
>             dates: [
>                "May 20, 2014",
>                "May 21, 2014",
>                "May 22, 2014",
>                "May 23, 2014",
>                "May 24, 2014",
>                "May 25, 2014",
>                "May 26, 2014"
>             ],
>             types: []
>          };
>
>          factory.getTimes = function() {
>             return $http.get('times.json').then(function(response) {
>                // add error handling and stuff here!!!
>                factory.times = response.data;
>                return response;
>             });
>          };
>
>          factory.getServiceTypes = function() {
>             return 
> $http.get('appointment_types.json').then(function(response) {
>                // add error handling and stuff here!!!
>                factory.types = response.data;
>                return response;
>             });
>          };
>
>          factory.getTimes();
>          factory.getServiceTypes();
>
>          return factory;
>       }
>    ])
>
> Regards
> Sander
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to