Custom grid editor plugin with isolated directive using ng-model
Hello again everyone.
I have so many angular questions ;)
This time i am trying to make a directive like the spectrum color picker.
I want to be able to use this directive multiple times in the main controller.
The problem is when i dont use an isolated scope then the value update all fields using the same directive. And if i use an isolated scope, then my ng-model contains nothing.
This is what i got. And i have tried to make it as simple as possible.
Did you manage to get it working?
I'm having a simular question when using a directive that I've developed using an isolated scope, when it renders the templateUrl view the associated ng-controller doesn't have the properties that I set using the isolated scope.
Let me ask you one final question...in your 'template-html', do you have any ng-controller initialisation? I assume not, according to the markup in your first post :)
If its simple like this you could also remove the templateUrl and just use it directly in your html <input type="text" my-directive ng-model="myModel" /> or <div my-directive ng-model="myModel"></div>, Just remeber to use transclude if you have something inside the div.
Custom grid editor plugin with isolated directive using ng-model
Hello again everyone. I have so many angular questions ;)
This time i am trying to make a directive like the spectrum color picker. I want to be able to use this directive multiple times in the main controller. The problem is when i dont use an isolated scope then the value update all fields using the same directive. And if i use an isolated scope, then my ng-model contains nothing.
This is what i got. And i have tried to make it as simple as possible.
Can anyone tell me what i have to do? Thanks!
Hi Bo,
Did you manage to get it working? I'm having a simular question when using a directive that I've developed using an isolated scope, when it renders the templateUrl view the associated ng-controller doesn't have the properties that I set using the isolated scope.
I pass a value to the model, but then in the memberpicker.controller it has no 'model' property in the $scope.
Thanks
Hi Nandoh.
Yes i got it working. But forgot to put the result here.
In my case it was like this
Thank you very much for your answer :)
Let me ask you one final question...in your 'template-html', do you have any ng-controller initialisation? I assume not, according to the markup in your first post :)
Thanks. Regards
Right.
I do not use ng-controller for my directives, just a div.
In a simple input i would do this.
If its simple like this you could also remove the templateUrl and just use it directly in your html
<input type="text" my-directive ng-model="myModel" />
or<div my-directive ng-model="myModel"></div>
, Just remeber to use transclude if you have something inside the div.Cheers.
is working on a reply...