diff --git a/docs/content/cookbook/deeplinking.ngdoc b/docs/content/cookbook/deeplinking.ngdoc index 491e3b799a7d..1e9c01616cfe 100644 --- a/docs/content/cookbook/deeplinking.ngdoc +++ b/docs/content/cookbook/deeplinking.ngdoc @@ -35,8 +35,8 @@ In this example we have a simple app which consist of two screens: angular.module('deepLinking', ['ngSanitize']) .config(function($routeProvider) { $routeProvider. - when("/welcome", {template:'welcome.html', controller:WelcomeCntl}). - when("/settings", {template:'settings.html', controller:SettingsCntl}); + when("/welcome", {templateUrl:'welcome.html', controller:WelcomeCntl}). + when("/settings", {templateUrl:'settings.html', controller:SettingsCntl}); }); AppCntl.$inject = ['$scope', '$route'] diff --git a/docs/content/tutorial/step_07.ngdoc b/docs/content/tutorial/step_07.ngdoc index f8b5cf527072..f0812278445e 100644 --- a/docs/content/tutorial/step_07.ngdoc +++ b/docs/content/tutorial/step_07.ngdoc @@ -72,8 +72,8 @@ __`app/js/app.js`:__ angular.module('phonecat', []). config(['$routeProvider', function($routeProvider) { $routeProvider. - when('/phones', {template: 'partials/phone-list.html', controller: PhoneListCtrl}). - when('/phones/:phoneId', {template: 'partials/phone-detail.html', controller: PhoneDetailCtrl}). + when('/phones', {templateUrl: 'partials/phone-list.html', controller: PhoneListCtrl}). + when('/phones/:phoneId', {templateUrl: 'partials/phone-detail.html', controller: PhoneDetailCtrl}). otherwise({redirectTo: '/phones'}); }]); diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js index def665faa6f5..70884b8f7c2e 100644 --- a/docs/src/ngdoc.js +++ b/docs/src/ngdoc.js @@ -54,7 +54,7 @@ Doc.prototype = { function extractWords(text) { var tokens = text.toLowerCase().split(/[,\.\`\'\"\#\s]+/mg); tokens.forEach(function(key){ - var match = key.match(/^(([\$\_a-z]|ng\:)[\w\_\-]{2,})/); + var match = key.match(/^(([\$\_a-z]|ng\:)[\w\_\-]+)/); if (match){ key = match[1]; if (!keywords[key]) { @@ -227,10 +227,10 @@ Doc.prototype = { 'default':match[6] }; self.param.push(param); - } else if (atName == 'returns') { + } else if (atName == 'returns' || atName == 'return') { match = text.match(/^\{([^}=]+)\}\s+(.*)/); if (!match) { - throw new Error("Not a valid 'returns' format: " + text); + throw new Error("Not a valid 'returns' format: " + text + ' in ' + self.file + ':' + self.line); } self.returns = { type: match[1], diff --git a/docs/src/templates/js/doc_widgets.js b/docs/src/templates/js/doc_widgets.js deleted file mode 100644 index bf49697d31e0..000000000000 --- a/docs/src/templates/js/doc_widgets.js +++ /dev/null @@ -1,313 +0,0 @@ -angular.module('ngdocs.directives', [], function($compileProvider) { - - var angularJsUrl; - var scripts = document.getElementsByTagName("script"); - var angularJsRegex = /^(|.*\/)angular(-\d.*?)?(\.min)?.js(\?[^#]*)?(#(.*))?$/; - for(var j = 0; j < scripts.length; j++) { - var src = scripts[j].src; - if (src && src.match(angularJsRegex)) { - angularJsUrl = src.replace(/docs(-next)?\.angularjs\.org/, 'code.angularjs.org'); - continue; - } - } - - - var HTML_TEMPLATE = - '\n' + - '\n' + - ' \n' + - '_SCRIPT_SOURCE_' + - '
\n' + - '_HTML_SOURCE_\n' + - ' \n' + - ''; - - $compileProvider.directive('docExample', ['$injector', '$log', '$browser', '$location', - function($injector, $log, $browser, $location) { - return { - restrict: 'E', - terminal: true, - compile: function(element, attrs) { - var module = attrs.module; - - //jQuery find() methods in this widget contain primitive selectors on purpose so that we can use - //jqlite instead. jqlite's find() method currently supports onlt getElementsByTagName! - var example = element.find('pre').eq(0), //doc-source - scriptSrc = '', - htmlSrc = example.text().replace(/\n' : ''). - replace('_HTML_SOURCE_', indent(htmlSrc, ' ')). - replace('_MODULE_', module ? '="' + module + '"' : '')); - - element.html(''); - element.append(tabs); - - try { - if (window.execScript) { // IE - window.execScript(scriptSrc || '"stupid IE!"'); // IE complains when evaling empty string - } else { - window.eval(scriptSrc); - } - } catch (e) { - alert(e); - } - - return function(docsAppScope) { - var modules = [ - function($provide) { - $provide.value('$browser', $browser); - $provide.provider('$location', function() { - this.$get = function() { - return $location; - }; - this.hashPrefix = this.html5Mode = angular.noop; - }); - $provide.decorator('$defer', function($rootScope, $delegate) { - return angular.extend(function(fn, delay) { - if (delay && delay > 500) { - return setTimeout(function() { - $rootScope.$apply(fn); - }, delay); - } else { - return $delegate.apply(this, arguments); - } - }, $delegate); - }); - } - ]; - module && modules.push(module); - - angular.bootstrap(livePreviewTab, modules). - invoke(['$rootScope', function(example$rootScope) { - element.bind('$destroy', docsAppScope.$root.$watch(function() { - // this propagates the $watch from the docs app to the example app - example$rootScope.$digest(); - })); - }]); - }; - - function jsFiddleButton(jsfiddle) { - var fixJsFiddleIssue132 = true; - if (jsfiddle !== 'false') { - if(jsfiddle === true) { - //dynamically generate a fiddle - var fiddleUrl = 'http://jsfiddle.net/api/post/library/pure/'; - - function jsFiddleEscape(text, prefix) { - return indent(text.replace(/<\/textarea>/gi,'</textarea>'), prefix); - } - - return '