<commit_before>/**
 * NewFeedController
 * @namespace pjfeedreader.posts.controllers
 */
(function () {
    'use strict';

    angular
	.module('pjfeedreader.feeds.controllers')
	.controller('NewFeedController', [ '$rootScope', '$scope', 'Feeds',
					   'Categories',NewFeedController]);
    
    /**
     * @namespace NewFeedController
     */

    function NewFeedController($rootScope, $scope, Feeds, Categories) {

	var self = this;

	self.submit = submit;
	self.newFeed = {} ;

	self.categories = []

	Categories.all().then(allCategorySuccessFn, allCategoryErrorFn)
	console.log('NFCtrl')
	console.log(self.categories)
        /**
         * @name allCategorySuccessFn
         * @desc Show success message
         */

	function allCategorySuccessFn(data, status, headers, config) {
	    
	    self.categories = data.data
	}
	
        /**
         * @name allCategoryErrorFn
         * @desc Show success message
         */

	function allCategoryErrorFn(data, status, headers, config) {
	    console.log('All Category error');
	}


	/**
	 * @name submit
	 * @desc Create a new Feed
	 * @memberOf pjfeedreader.feeds.controllers.NewFeedController
	 */
	function submit() {
	    console.log('Add submit pressed');

	    /* Tell listeners (e.g. IndexController) that a new feed was
	    added */
	    $rootScope.$broadcast('feed.added', {
		feed: self.newFeed,
		category: self.selectedCategory
	    });
	    $scope.closeThisDialog();
	    Feeds.add(self.newFeed.url, 'Default title', 
		      self.selectedCategory)
		.then(addFeedSuccessFn, 
		      addFeedErrorFn); 

	    /**
	     * @name addFeedSuccessFn
	     * @desc Show success message
	     */

	    function addFeedSuccessFn(data, status, headers, config) {
		console.log('Adding feed succesfully');
	    }

	    /**
	     * @name addFeedErrorFn
	     * @desc Show success message
	     */

	    function addFeedErrorFn(data, status, headers, config) {
		console.log('Error in adding')
		console.log(data)
		console.log(data.error);
	    }
	}
    }
})();
	<commit_msg>feat(feed): Add submit function, use new sercives<commit_after>/**
 * NewFeedController
 * @namespace pjfeedreader.posts.controllers
 */
(function () {
    'use strict';

    angular
        .module('pjfeedreader.feeds.controllers')
        .controller('NewFeedController', [ '$rootScope', '$scope', 'Feeds',
                                           'Categories',NewFeedController]);
    
    /**
     * @namespace NewFeedController
     */

    function NewFeedController($rootScope, $scope, Feeds, Categories) {

        var self = this;

        self.submit = submit;
        self.newFeed = {} ;

        self.categories = [];

        Categories.all().then(function(data) {
            self.categories = data.data;
        });

        /**
         * @name allCategorySuccessFn
         * @desc Show success message
         */


        /**
         * @name submit
         * @desc Create a new Feed
         * @memberOf pjfeedreader.feeds.controllers.NewFeedController
         */
        function submit() {

            /* Tell listeners (e.g. IndexController) that a new feed was
            added */
            $rootScope.$broadcast('feed.added', {
                feed: self.newFeed,
                category: self.selectedCategory
            });
            $scope.closeThisDialog();
            Feeds.add(self.newFeed.url, 'Default title', 
                      self.selectedCategory);

        }
    }
})();
	
{'fraction_non_alphanumeric': 0.12564991334488734, 'fraction_numerical': 0.0, 'mean_word_length': 2.200554528650647, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7248983', 'n_tokens_mistral': 1047, 'n_tokens_neox': 964, 'n_words': 199}