Hi im new to angular JS and just getting to grips with it, Im trying to create a filter that will compile the given string that is stored in the database. The HTML is below which passes history.activity to my dynamic filter with :this appended to pass in the current scope.
<ul>
<li ng-repeat=history in recentActivity>
{{ history.activity | dynamic:this }}</p>
</li>
</ul>
The history.activity variable contains a string in the format of an Angular template like below, these will vary as they are pulled in from the database based on the logged activity.
{{ history.username }} logged in at {{ history.created_date | date }}
My filter below is extremely basic and should compile the source but its just returning undefined.....
app.filter('dynamic', function ($compile) {
return function (source, scope) {
return $compile(source)(scope);
};
});
Any ideas? where am i going wrong with this? any help is greatly appreciated :)