Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function PostCtrl($scope,$http, $compile, $rootScope, CONFIG) {
- $scope.patternUrl = (function() {
- var regexp = /(https?://[^s]+)/gi;
- return {
- test: function(value) {
- //return regexp.test(value);
- if (regexp.test(value)) {
- $scope.form = {
- name: name,
- }
- return $scope.$watch('form', function(newVal, oldVal){
- $http({
- url: CONFIG.APIURL + 'post/ajaxcheck',
- method: "POST",
- data: {'query':newVal}
- }).success(function (data, status, headers, config) {
- var publisher = $('.timeline');
- publisher.data('scrabing', data);
- var template = "<div ng-repeat='item in items' ng-include='users.html'></div>";
- $('.publisher-timeline').html(template).fadeIn();
- var scope = $rootScope.$new();
- scope.items = [ { name: data.data }, { name: 'Tu' } ];
- $compile(document.getElementById('pub'))(scope);
- }).error(function (data, status, headers, config) {
- //ERROR
- });
- }, true);
- }
- }
- };
- })();
- }
- <div class="mdl-grid" ng-controller="PostCtrl">
- <div class="publisher-timeline" id="pub">
- <script type="text/ng-template" id="users.html">
- <p>{{ item.title }}</p>
- </script>
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement