Yep, I guess I can't have an isolate scope cause then the form elements and
stuff won't work.

On Friday, March 28, 2014, Jarrett Lusso <[email protected]> wrote:

> I'll have to give that a shot.
>
> On Friday, March 28, 2014, Kamalakar Gadireddy 
> <[email protected]<javascript:_e(%7B%7D,'cvml','[email protected]');>>
> wrote:
>
>> Jarrett,
>>
>> Can you just have a log to check and see if `$scope.$parent` is defined,
>> this is the only thing i see which might be undefined. And my suggestion is
>> do not create a new or isolated scope for your directives if thats case the
>> case you can change the code to  `$scope.$watch watchExpression` and it
>> should work.
>>
>>
>> On Fri, Mar 28, 2014 at 12:30 PM, Jarrett Lusso <[email protected]>wrote:
>>
>> Hey,
>>
>> So i was playing around with it all and the issue I'm having now is that
>> I don't have access to the scope in the same way I believe.
>>
>> watchExpression = [ctrl.$name, attrs.name, '$invalid'].join('.')
>> $scope.$parent.$watch watchExpression, (value) ->
>>      $scope.isError = value
>>
>> I had that setup so that I could put a class on the fields when an error
>> occurred. Not sure how to get this working now since I'm getting undefined
>> when I try and get inputs on the form. ctrl was the form because I had
>> require: '^form' in my directive
>>
>>
>> On Mon, Mar 24, 2014 at 10:54 PM, Jarrett Lusso <[email protected]>wrote:
>>
>> I will check this out on my flight tomorrow. Hopefully this is the fix! :)
>>
>>
>> On Mon, Mar 24, 2014 at 1:15 PM, Kamalakar Gadireddy 
>> <[email protected]>wrote:
>>
>> There you go you know what things that should not got in input so you can
>> block them and rest u can pass them to the input. In the example i have
>> shared you can see an for each loop
>>
>>      angular.forEach(attrs.$attr, function(name) {
>>
>>           // if condition when to copy the attribute, in your case you
>> will check to see if its no *label* or *hint *or any other thing that
>> should not got on to the input.
>>
>>           node.attr(name,origElement.attr(name))
>>      });
>>
>>
>> Instead of the simple input node you can replace it with your html. You
>> can play around with the example in 
>> plnkr.co<http://plnkr.co/edit/7U2uoN?p=preview>which i had shared and see it 
>> would copy all the attributes of the
>> directive to the input as explained above you need to block thing you don't
>> need. Play around and let me know.
>>
>>   demo.directive('simpleForm', ['$compile', function($compile) {
>>     var template =
>>     '<div class="input-wrapper text" data-ng-class="{\'field-error\':
>> isError}">' +
>>     '<label class="field-wrap">' +
>>       '<div class="label">' +
>>         '<i class="help-icon fa fa-question-circle" data-tooltip=""></i>'
>> +
>>       '</div>' +
>>       '<div class="field"><input></div>' +
>>     '</div>' +
>>     '</label>' +
>>   '</div>';
>>     var notForInput = ['simple-form', 'label', 'help'];
>>     return {
>>       restrict: 'EA',
>>       transclude: 'element',
>>       link: function(scope, element, attrs, model, transcludeElm) {
>>         var origElement = transcludeElm();
>>         var node = angular.element(template);
>>         var input = node.find('input');
>>         var toolTip = $('i', node);
>>         angular.forEach(attrs.$attr, function(na
>>
>>

-- 
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