Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //controller
- angular.module('app').controller('MainCtrl', function ($scope, $compile) {
- $scope.$on('insertItem',function(ev,attrs){
- var el = $compile( "<chart></chart>" )( $scope );
- $scope.insertHere = el;
- });
- });
- // directive
- angular.module('app')
- .directive('chart', function () {
- return {
- template: '<div>My chart</div>',
- restrict: 'E',
- link: function postLink(scope, element, attrs) {
- element.text('this is a chart');
- }
- };
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement