Beginner questions with AngularJS and directives - wrapping a jQuery component -
First of all, let me tell that I am just working to transition into clientAd programming. I am very new to JS. My previous experience is primarily in C and some assembly. I did a very simple php year ago when it was still 4.0. So in a nutshell, new to javascript, but somewhat like my head around it.
I have searched and concealed a lot but are not able to improve my issues.
I am finding the basic elements of AngularJS and it is quite good, but how do I know about my head how instructions work and how difficult it is to use data from custom control is.
The long story short I'm trying to make a custom control for elderly work with angularjs so I can use it as well.
Here's the control:
I have some other controls that I want to work but I think that if I can find one, I can easily ease others I can get from
Here is a link to a basic structure on this basis:
First of all,
link: functions (scope, element, etc.) I am trying to wrap my head that once I am doing a template, Attr) {attr. $ (Inspection of $ '', 'DPID', function (value) {if (value) {$ ('#' + scope.dpid) .datetimepicker ({Language: 'N', pick12HourFormat: true});} < / Pre> When I put that link in the instruction, it does nothing; I do not see any error. Scope.dpid is actually showing the control id, so I thought it would work But sorry that my understanding of Javascript shows that I am out of the realm or there is some nonsense where I have a
Once I get this, I do not know at all how to do this
Update Basic work Now, I have to know how to get the data. Here's a link to the new JSField update from the new control in my controller. Update 2 I think that I have an idea about making this data accessible, but about javascript I do not have any information, I have been dry again. I will do this by creating an object.
var elDatepicker = element.datetimepicker ({language: 'en', pick12HourFormat : True,}); However, when I try to use this object it is not feeling right, or I just missing some basic knowledge. Either way, it is certain that I am feeling stupid.
console.log (elDatepicker.getDate ()); If this fails, getDate is actually a method, at least it seems that it is in the plugin code. Instead of a separate scope, you can find the of your template ()
div and then DateTimePicker () . So you do not need id in your HTML: & lt; Datepicker model = "mydate" & gt; & Lt; / Datepicker & gt; Mindet = {{mydate}} I also recommend that replace: true : .directive ('datepicker', function ($ parse) {return {restrict: 'e', replace: correct, template: '' div class = \" well \ "& gt; & Lt; div class = \ "input -append \" & gt; '+' & lt; input data-format = \ "MM / dd / yyyy HH: mm: ss PP \" type = \ "text \" & Gt; & lt; / input & gt; '+' & lt; span class = \ "add-on \" & gt; & lt; i data-time-icon = \ "icon-time \" data-date- Icon = \ "icon-calendar \" & gt; & lt; / i & gt; & lt; / span & gt; '+' & lt; / div & gt; & lt; / div & gt ;, link : Function ( Area, element, ether) {var picker = element.find ('div'). Datetimepicker ({language: 'en' Pick12HorFormat: true}); var model = $ parse (attrs.model); picker.on ('changeate ', Function (e) {console.log (e.date.toString ()); console.log (e.localDate .toString ()); model.assign (scope, e.date.toString ()); radius. $ Applied ();}}}}}}}
What is the main use case for this is a bit difficult: we parse a feature And can get back the function on which there is a assign () method that helps us to change the scope property.
Comments
Post a Comment