I want to use This Plunker sample code to add some elements dynamically to HTML page using AngularJS. (You should run It in a new link, not in editor environment) This is my first experience in declaring AngularJS Directive (except for simple tests). I have two questions about this sample:
- My approach is using
Controller as
instead of$Scope
in my controllers. (I don't know the name of this approach!) So what should I do with the sample code above? since it uses$compile(...)($scope)
. which changes should be applied? - Is the Scope in Directive related to controller? So, If I could omit the scope from controller in this case, should I apply any changes to directive?