<!doctype html>
<html ng-app="app">
  <head>
  <script src="
https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js";></script>
        <script src="
https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-rc.4/angular.min.js
"></script>

  </head>
  <body ng-controller="MyController">

  </body>
</html>


<script>

angular.module('app', [])
.controller('MyController', ['$scope', function($scope {
$scope.test = 'test';
}])
.directive('helloWorld', function() {
return {
scope:{
nameStatic : '@',
select : '&'
},
restrict: 'E',
replace: 'true',
template: '<p ng-click="select()">Hello World!! {{nameStatic}}</p>',
link: function(scope, element, attributs){
console.log(attributs.nameStatic);
}
};
});


var element = "<hello-world name-static='Parametre statique'
select='testDirective()' id='screenshot'></hello-world>";
$('body').append(element);

var scope = angular.element('body').scope();
scope.$apply();

</script>

2014-10-03 8:19 GMT+02:00 JORDY David <david.jordy.sung...@gmail.com>:

> I am really lost, do you have an example a fiddler ?
>
> Le jeudi 2 octobre 2014 16:28:35 UTC+2, korneliusz wilgocki a écrit :
>>
>> So you have some action which append html to body, yes ?
>>
>> You have to $compile directive
>>
>> http://stackoverflow.com/questions/11771513/angularjs-
>> jquery-how-to-get-dynamic-content-working-in-angularjs
>> <http://www.google.com/url?q=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F11771513%2Fangularjs-jquery-how-to-get-dynamic-content-working-in-angularjs&sa=D&sntz=1&usg=AFQjCNGQXORFbcwpdh4lvNQofNMAKXSN6A>
>>
>>
>> 2014-10-02 16:24 GMT+02:00 JORDY David <david.jor...@gmail.com>:
>>
>>> Because I worked with this library. If you have an alternative in
>>> Javascript (vanilla), I am ok as well
>>>
>>> Le jeudi 2 octobre 2014 16:19:31 UTC+2, JORDY David a écrit :
>>>
>>>> Hi,
>>>>
>>>> I created a directive:
>>>> Code :
>>>> Sélectionner tout
>>>> <http://www.developpez.net/forums/d1473186/webmasters-developpement-web/javascript-ajax-typescript-dart/javascript/bibliotheques-frameworks/ajouter-directive-jquery/#>
>>>>  - Visualiser dans une fenêtre à part
>>>> <http://www.developpez.net/forums/d1473186/webmasters-developpement-web/javascript-ajax-typescript-dart/javascript/bibliotheques-frameworks/ajouter-directive-jquery/#>
>>>>
>>>> 1
>>>> 2
>>>> 3
>>>> 4
>>>> 5
>>>> 6
>>>> 7
>>>> 8
>>>> 9
>>>> 10
>>>> 11
>>>> 12
>>>> 13
>>>> 14
>>>> 15
>>>> 16
>>>>
>>>>
>>>> angular.module('TEST').directive('helloWorld', function() {
>>>>         return {
>>>>             scope:{
>>>>                 name : '=',
>>>>                 nameStatic : '@',
>>>>                 select : '&'
>>>>             },
>>>>             restrict: 'AEC',
>>>>             replace: 'true',
>>>>             template: '<p ng-click="select()">Hello World!! {{name}} 
>>>> {{nameStatic}}</p>',
>>>>             link: function(scope, element, attributs){
>>>>                 console.log(attributs.nameStatic);
>>>>             }
>>>>         };
>>>>     });
>>>>
>>>> I would like with Jquery add this directive in page html page
>>>>
>>>> Code :
>>>> Sélectionner tout
>>>> <http://www.developpez.net/forums/d1473186/webmasters-developpement-web/javascript-ajax-typescript-dart/javascript/bibliotheques-frameworks/ajouter-directive-jquery/#>
>>>>  - Visualiser dans une fenêtre à part
>>>> <http://www.developpez.net/forums/d1473186/webmasters-developpement-web/javascript-ajax-typescript-dart/javascript/bibliotheques-frameworks/ajouter-directive-jquery/#>
>>>>
>>>> 1
>>>> 2
>>>>
>>>>
>>>> $("body").append("<hello-world name-static='Parametre statique' 
>>>> select='testDirective()' id='screenshot'/>");
>>>>
>>>> I know I have to avoid to mix angularjs and Jquery but I am doing a
>>>> migration.
>>>>
>>>> How can I do ?
>>>>
>>>> Thanks in advance
>>>>
>>>  --
>>> 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 angular+u...@googlegroups.com.
>>> To post to this group, send email to ang...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/angular.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
> 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 angular+unsubscr...@googlegroups.com.
> To post to this group, send email to angular@googlegroups.com.
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to