小编Amb*_*Amb的帖子

如何在url javascript中传递"问号"

在Angularjs app中,我有一个像url的网址
http://url.com/my_app/#/store/items.
现在我想追加查询字符串,例如,
http://url.com/my_app/#/store/items?page=2.

但是在url中,javascript会编码"?" to "%3F"我不想要的内容.它应该保持"?" 只有在url中,angularjs $ location.search()才会为"%3F"返回任何内容.

怎么做?

javascript angularjs

40
推荐指数
2
解决办法
3万
查看次数

如何在AngularJS中更新元标记?

我正在使用AngularJS开发一个应用程序.我想在路由更改时更新元标记.
如何更新AngularJS中可以在页面上的"查看源"中显示的元标记?

这是一个HTML代码 -

  <!DOCTYPE html>
    <html ng-app="app">
        <head>
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <meta name="fragment" content="!" />
            <meta name="title" content="Test App">
            <meta name="description" content="Test App">
            <meta name="keywords" content="Test,App">

            <link rel="stylesheet" href="css/jquery-ui-1.10.2.custom.min.css" />
            <link rel="stylesheet" href="css/extra.css" />
            <script src="js/libs/jquery-1.8.3.min.js"></script>
            <script src="js/libs/jquery-ui-1.10.2.custom.min.js"></script>
            <script src="js/libs/angular.min.js"></script>
            <script src="js/controller.js"></script>
            <script src="js/routes.js"></script>
        </head>
        <body>
            <div ng-controller="mainCtrl" class="main-container" loading>
                <div class="container-holder">
                    <div class="container">
                        <div ng-include src='"elements/header.html"'></div>
                        <div ng-view class="clearfix"></div>
                    </div>
                </div>

                <div ng-controller="userCtrl" id="test">
                    <div class="container" class="login-container">
                        <div id="login-logo">
                            <img src="images/logo-300.png" alt="" class="login-img"/>
                            <br />
                            <div ng-view></div> …
Run Code Online (Sandbox Code Playgroud)

meta-tags angularjs

38
推荐指数
4
解决办法
4万
查看次数

如何在角度路由中传递查询字符串?

我正在使用AngularJS路由,我正在尝试查看如何使用查询字符串(例如, url.com?key=value).Angular不理解包含同名键值对的路由albums:

angular.module('myApp', ['myApp.directives', 'myApp.services']).config(
        ['$routeProvider', function($routeProvider) {
            $routeProvider.
            when('/albums', {templateUrl: 'albums.html', controller: albumsCtrl}).
            when('/albums?:album_id', {templateUrl: 'album_images.html', controller: albumsCtrl}).
            otherwise({redirectTo: '/home'});
        }],
        ['$locationProvider', function($locationProvider) {
            $locationProvider.html5Mode = true;
        }]
    );
Run Code Online (Sandbox Code Playgroud)

angularjs angularjs-routing

35
推荐指数
3
解决办法
7万
查看次数

输入类型'数字'的ng-model不工作angularjs

在intregrating requirejs之前,我已经将angularjs与angular app ..进行了集成,

<input type="number" value="{{cart.quantity}}" ng-model="cart.quantity" />
Run Code Online (Sandbox Code Playgroud)

在输入框中显示值.
但是在与requirejs集成之后,输入框的type ="number"没有显示值..输入框的类型="text"正在工作.

如何用type ="number"显示值?

谢谢

javascript requirejs angularjs

29
推荐指数
4
解决办法
3万
查看次数

如何防止ng-src在数据到达之前加载图像?

HTML:

 <img ng-src="{{plugins.filesPath.album_images.image}}{{album.cover_image}}" alt="{{album.title}}" />
Run Code Online (Sandbox Code Playgroud)

在运行应用程序时,它显示错误:

GET http://url.com/myApp/files/album_images/image/ 403 (Forbidden) 
Run Code Online (Sandbox Code Playgroud)

" http://url.com/myApp/files/album_images/image/ "是{{plugins.filesPath.album_images.image}}的值.

它显示错误,因为它会在所有数据到达之前加载图像.

如何在控制台中防止此错误?

angularjs

28
推荐指数
3
解决办法
3万
查看次数

在angularjs中,jquery的替代方法是什么?

我想从我的应用程序中删除jquery ..但我想在angularjs中替换$ .each ...我怎么能循环dom元素?在这里,我添加了我的代码..我想将它从jquery转换为angularjs

app.directive('activeu', function($location) {
        return function ($scope, element, attrs) {
            var menuMain = $scope.$parent.menuMain;
            var fullpath = $location.path().split('/');
            var current = fullpath[2];

            setTimeout(function() {
                $(".nav li a").each(function() {
                    if ($(this).attr('href') ==  '#!/page/' + current) {
                        $(this).parent().addClass('active');
                        $(this).closest('li.root-li').addClass('active');

                        if ($(this).closest('li.parent').length > 0) {
                            $(this).closest('li.parent').addClass('active');
                        }
                    }
                });

                $(".nav li a").on('click', function() {
                    current = $(this).attr('href');
                    $("#pages-menu .navigation li").each(function() {
                        if ($(this).hasClass('active')) {
                            $(this).removeClass('active');
                        }
                    });

                    $(".nav li a").each(function() {
                        if ($(this).attr('href') ==  current) {
                            $(this).parent().addClass('active');
                            $(this).closest('li.root-li').addClass('active');

                            if ($(this).closest('li.parent').length …
Run Code Online (Sandbox Code Playgroud)

jquery angularjs

26
推荐指数
2
解决办法
3万
查看次数

每次在AngularJS中更改网址时调用哪个函数?

我必须同时发出所有请求的队列,而不必等待angularjs中先前请求的响应.
我有一个加载函数,每当我更改url路由时显示加载div,但是在该函数中不能生成队列的arrray.

任何人都可以告诉我每次更改网址路由时在angularjs路由中调用哪个函数?
HEre是路线代码:

angular.module('myApp', ['myApp.directives', 'myApp.services', 'myApp.filters']).config(
    function($routeProvider, $locationProvider, $httpProvider) {
        $locationProvider.html5Mode(false);
        $locationProvider.hashPrefix('!');

        $httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';

        var loading = function (data, headersGetter) {
            $('loadingDiv').show();
            return data;
        };
        $httpProvider.defaults.transformRequest.push(loading);

        $routeProvider.
        when('/', {
            templateUrl: 'elements/home/home.html',
            controller: homeCtrl
        });
   });
Run Code Online (Sandbox Code Playgroud)

angularjs angularjs-routing

19
推荐指数
2
解决办法
2万
查看次数

如何使用node-webkit与快速服务器?

我正在使用nodejs和express开发一个应用程序.
我想将它导出为带有node-webkit的包.

如何启动服务器并使用它运行应用程序?

node.js express node-webkit

7
推荐指数
1
解决办法
3949
查看次数